> db.message.find() //查看message表(集合)里的数据记录
{ "_id" : ObjectId("587ecec592434f4240668413"), "user_id" : 10 }
> db.message.insert({title: 'hello', content: 'Hello world!'}) //往message表(集合)里插入一条记录
WriteResult({ "nInserted" : 1 })
> db.message.find()
{ "_id" : ObjectId("587ecec592434f4240668413"), "user_id" : 10 }
{ "_id" : ObjectId("58a55ef57bc9a525061d0608"), "title" : "hello", "content" : "Hello world!" }
> db.message.remove({user_id: 10}) //message表(集合)里删除一条记录
WriteResult({ "nRemoved" : 1 })
> db.message.find()
{ "_id" : ObjectId("58a55ef57bc9a525061d0608"), "title" : "hello", "content" : "Hello world!" }
> db.message.update({title: 'hello'}, {$set: {title: 'Hello'}}) //message表(集合)里更新一条记录
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
> db.message.find()
{ "_id" : ObjectId("58a55ef57bc9a525061d0608"), "title" : "Hello", "content" : "Hello world!" }