标签:第一个 name dynamic comment .com alt 64位 基本 match
> show dbs; admin 0.000GB local 0.000GB > use testdb; switched to db testdb > post={"title":"My Blog Post", ... "content":"HaHa", ... "date":new Date()} { "title" : "My Blog Post", "content" : "HaHa", "date" : ISODate("2017-07-07T03:20:44.698Z") } > db.blog.insert(post) WriteResult({ "nInserted" : 1 }) > db.blog.find() { "_id" : ObjectId("595efe1af713ea7372854b9c"), "title" : "My Blog Post", "content" : "HaHa", "date" : ISODate("2017-07-07T03:20:44.698Z") }
> db.blog.findOne() { "_id" : ObjectId("595efe1af713ea7372854b9c"), "title" : "My Blog Post", "content" : "HaHa", "date" : ISODate("2017-07-07T03:20:44.698Z") }
> post.comments=[] [ ] > db.blog.update({"_id":ObjectId("595efe1af713ea7372854b9c")},post) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) > db.blog.findOne() { "_id" : ObjectId("595efe1af713ea7372854b9c"), "title" : "My Blog Post", "content" : "HaHa", "date" : ISODate("2017-07-07T03:20:44.698Z"), "comments" : [ ] }
> db.blog.remove({"_id":ObjectId("595efe1af713ea7372854b9c")}) WriteResult({ "nRemoved" : 1 }) > db.blog.findOne() null
> help db.help() help on db methods db.mycoll.help() help on collection methods sh.help() sharding helpers rs.help() replica set helpers help admin administrative help help connect connecting to a db help help keys key shortcuts help misc misc things to know help mr mapreduce show dbs show database names show collections show collections in current database show users show users in current database show profile show most recent system.profile entries with time >= 1ms show logs show the accessible logger names show log [name] prints out the last segment of log in memory, ‘global‘ is default use <db_name> set current database db.foo.find() list objects in collection foo db.foo.find( { a : 1 } ) list objects in foo where a == 1 it result of the last line evaluated; use to further iterate DBQuery.shellBatchSize = x set default number of items to display on shell exit quit the mongo shell
标签:第一个 name dynamic comment .com alt 64位 基本 match
原文地址:http://www.cnblogs.com/lemon-le/p/7133070.html