Start
①: Before starting, we will assign a folder to MongoDB, which is named "DB", which is used to store mongodb data.
②: Microsoft logo +r, enter CMD, first find the "MongoDB" path, and then run the Mongod Open command, while using--dbpath to specify the data storage location is "DB" folder.
③: Finally to see whether the open success, the information learned that MongoDB uses 27017 port, then we will type "http://localhost:27017/" in the browser,
After opening, MongoDB tells us that on 27017 add 1000 can view MongoDB's management information in HTTP mode.
Three: basic operation
Because it is the beginning, about the basic "additions and deletions to change", we open a cmd, enter the MONGO command to open the shell, in fact, this shell is the client of MongoDB,
Also is a JS compiler, the default connection is the "test" database.
<1> Insert Operations
Well, the database has, the next step is the collection, here to take the collection named "Person", note that the document is a JSON extension (Bson) Form.
<2> Find operations
After we insert the data, it is definitely to find out, or plug in the white plug, here to pay attention to two points:
① "_id": This field is the GUID that the database gives us by default, the purpose is to guarantee the uniqueness of the data.
② strictly in accordance with the Bson form of the document, but it doesn't matter, the error is very powerful.
<3> Update operation
The first parameter of the Update method is "find condition", the second parameter is "updated value", and learning C #, I believe it is well understood.
<4> Remove operation
Remove if no parameters will delete all data, oh, very dangerous operation, in MongoDB is a non-revocable operation, think twice before the line.
Startup Settings MongoDB