Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set mongo db dbpath on windows 7?

Tags:

mongodb

How do I set mongo db dbpath on windows 7? I created a directory in my my C drive as data/db but it is not working.

like image 354
Shreyash Avatar asked Dec 16 '11 09:12

Shreyash


People also ask

Can I use MongoDB in Windows 7?

MongoDB for Windows 64-bit runs only on Windows Server 2008 R2, Windows 7 64-bit, and newer versions of Windows. This build takes advantage of recent enhancements to the Windows Platform and cannot operate on older versions of Windows.


3 Answers

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

As documentation says

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.

If you prefer to place datafiles elsewhere, use the --dbpath command line parameter when starting 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.

like image 200
lig Avatar answered Nov 16 '22 00:11

lig


Additionally add

C:\Program Files\MongoDB\Server\3.0\bin;

to your Path variable.

like image 37
Michael Brenndoerfer Avatar answered Nov 16 '22 01:11

Michael Brenndoerfer


--> in the path of windows paste url install for example: C:/mongodb/bin
-->here mongod.exe and mongo.exe

add C:/mongodb/bin

open cmd, write: mongod open other cmd,write mongo

enjoy :)

PD: It's the same for other python, ruby etc. Windows is hurts T_T haha

like image 29
joelengt Avatar answered Nov 16 '22 00:11

joelengt