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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值