Chinaunix首页 | 论坛 | 博客
  • 博客访问: 602483
  • 博文数量: 103
  • 博客积分: 2269
  • 博客等级: 大尉
  • 技术积分: 1108
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-23 16:32
文章分类

全部博文(103)

文章存档

2012年(61)

2011年(42)

分类: 数据库开发技术

2012-02-17 17:49:09

[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" ] }
>
阅读(10747) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~