mongodb is currently a very popular non-relational database (nosql), because of its simple operation, completely free, open source code, etc.It is favored by IT practitioners,And is widely deployed in actual production environments.This article teaches you 8 days to learn mongodb-the first day of basic introduction,Interested friends come to understand
Regarding the benefits of mongodb, the advantages and the like are not mentioned here,The only thing to talk about is that there are three elements in mongodb:database, collection, document, where "collection"
It corresponds to the "table" in the relational database, and the "document" corresponds to the "row".
On the mongodb official website, we found that there are 32bit and 64bit, this depends on your system,But here are two things to note:
①:According to industry rules,Even numbers are "stable versions" (such as:1.6.x, 1.8.x) and odd numbers are "development versions" (such as:1.7.x, 1.9.x). I believe everyone knows the difference between the two versions.
②:The 32-bit mongodb can only store 2g data at most, and the 64-bit is unlimited.
I will download the "2.0.2 version, 32bit" here, ok. After downloading, I will put it on "e-disk" and change the folder name to "mongodb".
①:Before starting,We are going to specify a folder for mongodb,It is named "db" here to store mongodb data.
②:Microsoft logo + r, enter cmd, first find the path of "mongodb", and then run the mongod start command,Also use --dbpath to specify the data storage location as the "db" folder.
③:Finally, it depends on whether it is successfully opened.From the information in the picture,mongodb uses port 27017, then we type "http://localhost:27017/" in the browser,
After opening, mongodb tells us that add 1000 on 27017 can view mongodb management information in http mode.
Since it is the beginning,Generally speaking, the basic "add, delete, check and change", we open another cmd, enter the mongo command to open the shell, in fact, this shell is the client of mongodb
It is also a js compiler,The "test" database is connected by default.
OK, the database is there,The next step is collection,Here the collection name is "person". It should be noted that the document is a json extension (bson) form.
After we insert the data,It must be found, otherwise it will be inserted in vain,There are two points to note here:
① "_id":This field is the guid added to the database by default, the purpose is to ensure the uniqueness of the data.
② write documents strictly in the form of bson,But it doesn't matter,Error prompts are still very powerful.
The first parameter of the update method is "find condition", and the second parameter is "updated value". I have learned c#and believe it is still well understood.
remove without parameters will delete all data,Ha ha, very dangerous operation,Is an irrevocable operation in mongodb,Think twice.
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- xcode - pod install [!] no `podfile 'found in the project directory
- dart - flutter: the instance member'stars' can't be accessed in an initializer error