In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
MongdoDB Instance-》Database-》Collection-》Document-》Field (key/value pair)
bin execute./ mongod startup & background startup
./ mongo goes into the mongoDB shell, many of which are commands like mysql show dbs(view database)
The requested URL/data/db/mongod.lock is not empty was not found on this server.
kill off mongod, delete mongod.lock, this file is similar to the cache file that records mongodb still started
create a database
use nameDB Create a database named nameDB and insert the data before viewing it via show dbs
delete database
use nameDB First enter database db.dropDatabase() Then delete the database (if you do not enter the corresponding database, the test database will be deleted by default)
Creating a collection in a database
db.createCollection("collectionName")
Delete a specified collection from a database
db.collectionName.drop()
Insert a document into a collection
db.collectionName.insert({"nameDocKey":"nameDocValue"}) Similar to Save.
query aggregate data
db.collectionName.find() query.pretty() query and format display db.collectionName.find({"key":"value"}); query specified document
modify a document
db.collectionName.update({"key":"value"},{"newKey":"value"},{upsert:true}) upsert=true If not present, insert db.collectionName.update({"key":"value"},{$set:{"oldKey":"newValue"}) Modify specified attributes
delete documents
db.collectionName.remove({}) Delete all documents in the collection without deleting the collection db.collectionName.list.remove({"key":"value"}) Delete specified document
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.