About the benefits of MongoDB, advantages and so on here is not said, the only thing to say is that MongoDB has ternary: Database, collection, document, where "collection"
is "table" in the corresponding relational database, "document" corresponds to "row".
One: Download
On the MongoDB official website, we found that there are 32bit and 64bit, this depends on your system, but here are two points to note:
①: According to the industry rules, even "stable version" (such as: 1.6.x,1.8.x), odd for "development version" (such as: 1.7.x,1.9.x), the difference between the two versions I believe everyone knows it.
②:32bit MongoDB can only store 2G of data, 64bit there is no limit.
I will download the "2.0.2 version, 32bit", OK, after downloading I put the "e-Disk", change the folder name "MongoDB".
Two: 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.
MongoDB Learning Summary-1 (Basic primer)