`
linmomo02
  • 浏览: 179192 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ubuntu mongodb 安装

阅读更多

1.下载mongodb,到官网下载最新的稳定版本:http://www.mongodb.org/downloads

2.解压下载的包 tar -zxvf mongodb-linux-i686-2.0.4.tgz

3.mongodb默认的数据存储路径是/data/db/ 所以先创建目录  mkdir /data/db

4.运行  ./bin/mongod启动服务。

5.运行 ./bin/mongo 启动shell,通过javascript shell可以操作数据库。

相关命令如下:

        show dbs                     show database names
        show collections             show collections in current database
        show users                   show users in current database
        show profile                 show most recent system.profile entries with time >= 1ms
        use <db name>                set curent database to <db name>
        db.help()                    help on DB methods
        db.foo.help()                help on collection methods
        db.foo.find()                list objects in collection foo
        db.foo.find( { a : 1 } )     list objects in foo where a == 1
        it                           result of the last line evaluated; use to further iterate

在MongoDB中,在使用Database或Collection前不需要提前创建,在使用的过程中会 自动创建。

 

更多使用详见:http://www.mongodb.org/display/DOCS/Tutorial

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics