[root@roothomes ~]$ /home/mongodb/bin/mongo localhost:60000/admin
MongoDB shell version: 2.0.2
connecting to: localhost:60000/admin
> use roothomesDB
switched to db roothomesDB
> db.createCollection("coll01");
{ "ok" : 1 }
> userInfo = { "name" : "ysb" , "age" : "20"};
{ "name" : "ysb", "age" : "20" }
> userInfo
{ "name" : "ysb", "age" : "20" }
> db.coll01.save(userInfo);
> db.coll01.find();
{ "_id" : ObjectId("4f3e1f0c6667ba049798573a"), "name" : "ysb", "age" : "20" }
> userInfo = { "name" : "ysb" , "age" : "20" ,"users" : ["xxx","yyy","zzz"]};
{ "name" : "ysb", "age" : "20", "users" : [ "xxx", "yyy", "zzz" ] }
> userInfo
{ "name" : "ysb", "age" : "20", "users" : [ "xxx", "yyy", "zzz" ] }
> db.coll01.save(userInfo);
> db.coll01.find();
{ "_id" : ObjectId("4f3e1f0c6667ba049798573a"), "name" : "ysb", "age" : "20" }
{ "_id" : ObjectId("4f3e1f476667ba049798573b"), "name" : "ysb", "age" : "20", "u sers" : [ "xxx", "yyy", "zzz" ] }
>
阅读(10795) | 评论(0) | 转发(0) |