摘要: mongo提供了help功能,可以帮助我查看一些命令。下面是示例:> help db.help() help on db methods db.mycoll.help() help on collection methods rs.help() help on replica set methods help connect connecting to a db help help admin ... 阅读全文
posted @ 2013-02-01 16:50 醇酒醉影 阅读(1697) 评论(1) 推荐(0) 编辑
摘要: 1. 新建数据库命名的大小写数据库的命令应使用小写字母,但大写字母也是支持的,例如 TYC。不过此时不能再添加 tyc 数据库了,会提示错误:> use TYCswitched to db TYC> show collections> show dbsGps 73.8720703125GBTYC (empty)admin (empty)config 0.0625GBtest 0.078125GB> db.tianyc.t1.insert({name:'x'})> show collectionssystem.indexestianyc.t1> 阅读全文
posted @ 2013-02-01 16:14 醇酒醉影 阅读(1621) 评论(0) 推荐(0) 编辑
摘要: 组织集合的一种惯例是使用“.”字符分开的按命名空间划分的子集合。例如,一个带有博客功能的应用可能包含2个集合,分别是blog.posts和blog.authors。这样做的目的只是为了使得组织结构更清晰,便于管理,也就是说blog集合和这两个集合之间没有任何关系。在mongoDB中使用子集合来组织数据是个很好的方法,在此强烈推荐。 阅读全文
posted @ 2013-02-01 16:05 醇酒醉影 阅读(440) 评论(0) 推荐(0) 编辑