Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 Windows 8 开发人员计算机和用于 win32 的 mongodb。 Mongo\data\db默认使用 dbpath 存储数据。
\data\db
我可以dbpath在配置文件中设置,但我必须添加-f \path\to\config或mongo命令mongod。
dbpath
-f \path\to\config
mongo
mongod
如何为mongo和设置默认配置文件mongod?
据我所知,配置文件没有默认位置。也不在linux上。打包的安装程序会创建一个启动脚本,该脚本使用该-f选项启动守护程序。
-f
您可以在 windows 下创建一个服务来为您执行此操作,或者从 .bat 文件运行守护程序。
为什么不想使用:
mongod --config /etc/mongodb.conf mongod -f /etc/mongodb.conf
bat您可以使用此参数编写文件。
bat