大数据上课记录

MongoDB

sudo service mongodb start

pgrep mongo -l
978 mongod

mongo
MongoDB shell version: 2.6.10
connecting to: test

show dbs
School  0.078GB
admin   (empty)
local   0.078GB

use School
switched to db School

show collections
system.indexes
> db.createCollection('teacher')
{ "ok" : 1 }

> db.createCollection('student')
{ "ok" : 1 }

> db.student.insert({_id:1, sname: 'zhangsan', sage: 20})
WriteResult({ "nInserted" : 1 })

> db.student.save({_id:1, sname: 'zhangsan', sage: 22})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

猜你喜欢

转载自www.cnblogs.com/IAMzhuxiaofeng/p/8931462.html