Mongodb 安装

ee@ubuntu:~$ curl http://downloads.mongodb.org/linux/mongodb-linux-i686-1.6.4.tgz > mongo.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 23.9M  100 23.9M    0     0  12799      0  0:32:45  0:32:45 --:--:-- 18163
lee@ubuntu:~$ tar xzf mongo.tgz
lee@ubuntu:~$ sudo chown 'id -u' /data/db
[sudo] password for lee: 
chown: invalid user: `id -u'
lee@ubuntu:~$ sudo chown 'lee' /data/db
lee@ubuntu:~$ ./mongodb-linux-i686-1.6.4
bash: ./mongodb-linux-i686-1.6.4: is a directory
lee@ubuntu:~$ ./mongodb-linux-i686-1.6.4/bin/mongod
./mongodb-linux-i686-1.6.4/bin/mongod --help for help and startup options
Tue Mar 15 02:07:01 MongoDB starting : pid=3273 port=27017 dbpath=/data/db/ 32-bit
--华丽的分隔线 以上为mongodb下载 安装 及启动的一个过程
 
connecting to: test
> db.foo.save({a:1})
d> db.find()
Tue Mar 15 02:09:35 TypeError: db.find is not a function (shell):0
> db.foo.find()
{ "_id" : ObjectId("4d7f2cc843573cddf3c70cb7"), "a" : 1 }
> db.foo.save(a:2})
Tue Mar 15 02:12:50 SyntaxError: missing ) after argument list (shell):0
> db.foo.find()
{ "_id" : ObjectId("4d7f2cc843573cddf3c70cb7"), "a" : 1 }
> show db
Tue Mar 15 02:14:33 uncaught exception: don't know how to show [db]
> show dbs
admin
local
test
> use test
switched to db test
> show table 
Tue Mar 15 02:20:03 uncaught exception: don't know how to show [table]
> show tables
foo
 
以上为mongodb 客户启动 创建及存储的过程。
原文地址:https://www.cnblogs.com/chenli0513/p/1985103.html