MongoDB has three triples: a database , a collection , a document , where "collection" corresponds to the "table" in the relational database, and "document" corresponds to "row".
Install MongoDB: Go to the official website to download the corresponding system MongoDB compression package, after extracting the folder renamed to MongoDB (if installed to D disk), and in the MongoDB Folder New Blog folder (equivalent to create a database, blog for the database name) As the storage directory for the project content.
Open a command-line window and go to the bin directory to execute the command:
Mongod--dbpath. /blog/
The command means to set the blog folder as the project's storage directory and start the database.
Open a cmd again, enter the MONGO command to open the shell, the shell is the client of MongoDB, the default connection is the "test" database.
Set a collection called "person" (the relational database is equivalent to establishing a table named person)
Inserting Data
Db.person.insert () Db.person.insert ({"Name": "lbs", "Age": Ten}) Db.person.insert ({"Name": "CCX", "Age": 10})
Find data
Db.person.find () db.person.find ({"Name": "lbs"})//Find the document named lbs in the Person collection Db.person.find ()//without the parameters find all documents in the person collection $ GT: Greater Than (>) $gte: Greater Than or equal to (>=) $lt: Less Than (<) $lte: less than or equal to (<=) $ne: Not equal to (! =) $in: Contains $nin: does not contain $or: or
Update data
Delete Data
Understanding the MongoDB Database