mongodb 的进库操作

mongo

 

show dbs

 

use  xxx

 

show collections

 

db.xxx.insert({}) // 添加一个空内容

 

db.xxx.find()

 

db.users.update({ "_id" : ObjectId("xxxx")},{$set:{"xxx":true}})

 

db.users.update({'_id': ObjectId("5b70ef06db6824249420a31d")},{$set:{issuper: true}}) // 给这个id 的isspuer 设置为true

 

db.getCollection('users').updateMany({ name: /.$/ }, {$set:{"payType": "1"}});

// 修改所有的name payType 为1

 

>WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

 

db.products.insert( { item: "card", qty: 15 } )




 

posted @ 2017-09-22 17:55  adouwt  阅读(263)  评论(0编辑  收藏  举报