In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Let's not talk about the benefits and advantages of mongodb here. The only point to talk about is that there are three elements in mongodb: databases, collections, documents, and "collections".
It corresponds to the "table" in the relational database and the "document" corresponds to the "row".
One: download
When we go to MongoDB's official website, we find that there are 32bit and 64bit, which depends on your system, but here are two notes:
①: according to industry rules, the even number is "stable version" (for example: 1.6.Xpai1.8.x) and the odd number is "development version" (for example: 1.7.Xpai1.9.x). I believe we all know the difference between the two versions.
②: 32bit's mongodb can only store a maximum of 2 gigabytes of data, and there is no limit to 64bit.
I will download "2.0.2 version, 32bit", ok here. After downloading, I will put it on the "E disk" and change the folder name to "mongodb".
Two: start
①: before starting, we need to specify a folder for mongodb, which is named "db" to store mongodb data.
②: Microsoft logo + R, type cmd, first find the path to "mongodb", then run the mongod open command, and use-- dbpath to specify the data storage location in the "db" folder.
③: finally, to see if it is enabled successfully, we know from the information in the figure that mongodb uses port 27017, so we type "http://localhost:27017/"" in the browser.
After opening it, mongodb told us that on 27017, Add 1000 can view the management information of mongodb in http mode.
Three: basic operation
Since this is the beginning, we will roughly talk about the basic "add, delete, check and correct". Let's open a cmd and enter the mongo command to open shell. In fact, this shell is the client of mongodb.
Is also a js compiler, the default connection is the "test" database.
Insert operation
OK, with the database, the next step is the collection. Here, the collection is named "person". Note that the document is an Bson form of json.
Find operation
After we insert the data, we must find it out, otherwise it will be in vain. We should pay attention to two points here:
① "_ id": this field is the GUID that the database adds to us by default to ensure the uniqueness of the data.
② strictly writes documents in the form of Bson, but it doesn't matter, error prompts are still powerful.
Update operation
The first parameter of the update method is "search condition", and the second parameter is "updated value". I believe it is easy to understand.
Remove operation
If there are no parameters in remove, all data will be deleted, hehe, very dangerous operation, in mongodb is an irrevocable operation, look before you leap.
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.