当前位置:数据库 > DB2 >>

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
 

 
作者 linmomo02
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,