1 安装
|
|
等待安装成功1234To have launchd start mongodb now and restart at login: brew services start mongodbOr, if you don't want/need a background service you can just run: mongod --config /usr/local/etc/mongod.conf
根据提示启动服务
|
|
2 使用
|
|
创建数据库12345678910111213141516> show dbsadmin 0.000GBlocal 0.000GB> use testswitched to db test// 这时候并不会显示test,要插入一条数据才可以> show dbsadmin 0.000GBlocal 0.000GB> db.test.insert({name: 'lxc'})WriteResult({ "nInserted" : 1 })> show dbsadmin 0.000GBlocal 0.000GBtest 0.000GB>
删除数据库12345678> dbtest> db.dropDatabase();{ "dropped" : "test", "ok" : 1 }> show dbsadmin 0.000GBlocal 0.000GB>