且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Windows 7上设置mongo db dbpath?

更新时间:2023-01-08 22:21:43

mongodb数据目录不是特定于应用程序的.它是mongod.exe特定于过程的.

The mongodb data dir is not application specific. It is mongod.exe process specific.

文档所述

默认情况下,MongoDB将数据存储在\ data \ db中,但不会 自动创建该文件夹,因此我们在这里进行操作:

By default MongoDB will store data in \data\db, but it won't automatically create that folder, so we do so here:

C:\> mkdir \data
C:\> mkdir \data\db Or you can do this from the Windows Explorer, of course.

如果您希望将数据文件放置在其他位置,请使用--dbpath命令 启动mongod.exe时输入行参数.

If you prefer to place datafiles elsewhere, use the --dbpath command line parameter when starting mongod.exe.

这意味着您需要创建C:\data\db目录或以数据目录的完整路径作为--dbpath参数值开始mongod.exe.

This means that you need to create C:\data\db directory or start mongod.exe with the full path to your data dir as --dbpath parameter value.