📜  MongoDB 命令 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:01.136000             🧑  作者: Mango

代码示例4
show dbs # <=> Print a list of all databases on the server.
use  # <=> Switch current database to 
show collections # <=> Print a list of all collections for current database.
db.people.insert({name:"Ashwin",gender:"m"}) # <=> Inserts a new "person" collection with a new object in that collection
db.people.find() # <=> Find all persons in the collection
db.people.update({name:"Ashwin"},{gender:"f"}) # <=> Updates the selected (1st parameter) person with new value(2nd parameter)
db.people.remove({name:"Ashwin"}) # <=> Remove where name is "Ashwin"
db.people.drop() # <=> Delete the "people" collection