我是 mongodb 的新手。
我刚刚在我的MAC上安装了mongoDB,
看完这个 YouTube 视频后
在 mongo shell 中,我输入 show dbs 并得到有线输出。
请帮助我理解并解决这个问题
> show dbs
2017-09-11T02:45:34.298+0530 E QUERY [thread1] Error: listDatabases failed:{
"ok" : 0,
"errmsg" : "unable to open cursor at URI statistics:table:collection-2-2362555297355466682. reason: No such file or directory",
"code" : 43,
"codeName" : "CursorNotFound"
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:62:1
shellHelper.show@src/mongo/shell/utils.js:769:19
shellHelper@src/mongo/shell/utils.js:659:15
@(shellhelp2):1:1
经过几次研究后,我找到了解决方案并分享了我学到的所有知识,因此没有新学习者会像我一样陷入困境。
我的错 :
我盯着 mongodb 使用:
mongod --config "c:\MongoDB\Mongod.cfg"
并通过运行启动 mongo shell
mongo
启动 Mongo DB 和 Shell
然后了解每个命令的作用:
|*| Start Mongo DB with default config :
mongod
|*| Start Mongo DB with config file :
mongod -f "c:\MongoDB\Mongods.cfg"
|Or|
mongod --config "c:\MongoDB\Mongod.cfg"
|O| Start Mongo DB with config flags :
mongod --dbpath "c:\mongodb\data\nameMdb" --logpath "c:\mongodb\log\nameMdbLog.log" --directoryperdb --logappend
因此相应地我们也应该使用 mongo 来启动 shell :
|*| Start Mongo shell with default config :
mongo
|*| Start Mongo shell with localhost config flags :
mongo --host localhost --port 28888
|*| Start Mongo shell with public config flags and user details :
mongo --username <user> --password <pass> --host <Host.IP.Adrs> --port 28888
|*|这里用示例解释了创建配置文件:
https://github.com/mongodb/mongo/blob/master/rpm/mongod.conf https://github.com/mongodb/mongo/blob/master/rpm/mongod.conf
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)