In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
About the default setting of mogodb database: 1. The default port setting is: 270172. The default location of the database file is: c:/data/db. It is recommended to modify it to another disk location. You must create a data/db folder in the root directory of the disk. The default log recording method of 3.mongodb database is to rewrite or overwrite. It is recommended to use additional logging method: mongod-- logpath "d:/data/log/mongodb.log"-- logappendmongo shell operation command: 1. Connect to mongoDB database mongo-- host hostname/ip-- port 27017 [databaseName] example: mongo-- host 172.0.0.1-- port 27017 mydbs2. The collection operation db.student.drop (); / / deletes the collection student 3. Key points of document operation: understand the $inc/$set/$unset/$push/$pop/upsert modifier / / insert the document db.student.insert ({"name": "zhangsan"}) into the student collection; / / query the document using find (); db.student.find (); / / update the id=58d4ccd4126ab1e4ca76aa73 document, modify or add its name key pair db.student.update ({"_ id": ObjectId ("58d4ccd4126ab1e4ca76aa73")}, {"$set": {"name": "xiaoming"}}) / / modify the document using update () db.student.update ({"name": "xiaoming"}, {"$set": {"age": 23}}); db.student.update ({"name": "xiaoming"}, {"$set": {"name": "Jackie Chan"}}) Result: {"_ id": ObjectId ("58d4ccd4126ab1e4ca76aa73"), "name": "Jackie Chan", "age": 23} / / format the document db.student.find () .pretty () {"_ id": ObjectId ("58d4ccd4126ab1e4ca76aa73"), "name": "xiaoming", "age": 23} / / delete document syntax: db.collection.remove (condition, {justOne:, writeConcern:}) query: (optional) conditions for deleted documents. JustOne: (optional) if set to true or 1, only one document is deleted. WriteConcern: (optional) the level at which the exception is thrown. For example: db.student.remove ({"name": "Jackie Chan"}, {"justOne": true, "writeConcern": true}); 4. Conditional operators $lt (), $gte (> =), $lte (
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.