Location>code7788 >text

Analyzing Mongodb Injection

Popularity:546 ℃/2024-11-06 18:55:46

preamble

Not very good at Mongodb usage, here's a learning curve

brief introduction

Mongodb is a non-relational database (NoSQL), and some of the most common concepts we know in MySQL are Database, Table, Column, Record, and Index, which map to Mongodb as roughly Database, Collection, Field, Document, and Index. These terms map to Mongodb as Database, Collection, Field, Document, Index.

comprehensive database

There's nothing to say, it's the same thing as a Mysql database, which holds a number of collections

set (mathematics)

A document group, which holds a number of documents, is similar to a table with a number of records in it

(computer) file

A piece of data that is in JSON format, MongoDB documents do not need to have the same fields set, and the same fields do not need to be the same data type, for example:

{
  "name": "F12",
  "age": 20,
  "status": "live",
  "group": ["handsome", "low", "nomoney"]
}

Mongodb Syntax

  • Create a database:use DATABASE_NAME If the database exists, it will be switched, if not, it will be created.
  • View all databases:show dbs
  • Delete the current database:()
  • View the current database:()
  • View the database version:()
  • Insert data:db.COLLECTION_NAME.insert(document)
  • Query Data:db.COLLECTION_NAME.find(query)
  • Compare statements:$gt$lt$gte$lte

  • OR:MongoDB OR The conditional statement uses the keyword$or

  • AND: Same usage as OR
  • limit:db.COLLECTION_NAME.find().limit(NUMBER) Specify the number of outputs

  • skip:skip() method for skipping the specified amount of data. Accepts a numeric argument as the number of records to skip.db.COLLECTION_NAME.find().limit(NUMBER).skip(NUMBER)

  • marginal notes//
  • Convert to json:tojson()

These are just a few examples, please explore more usage on your own!

reach a verdict

After learning the syntax, do not feel much research (, basically is the use of syntactic features to inject, such as the use of $regex to match the Boolean blind injection, later if you encountered a more specific injection, and then to add ......