I got an error about dbpath (/data/db/) does not exist
, but /etc/mongodb.conf
named it dbpath = /var/lib/mongodb.
So, which is the default dbpath for MongoDB?
By default MongoDB data files are stored in C:\ProgramData\FotoWare\FotoWeb\Operations\MongoDBData.
In MongoDB default database is test. If you did not create any Database and started inserting collection then all collections are stored in the Default Database. Show list of Databases : You can check currently selected database, using the command “show dbs“.
Click on environment variables button under the advanced tab in system properties dialog. Select path variable and click on the edit button. Add new path variable, copy and paste the bin path location of the MongoD files installed. In my system, MongoDB is installed in “C:\Program Files\MongoDB\”.
The default dbpath for mongodb is /data/db
.
There is no default config file, so you will either need to specify this when starting mongod
with:
mongod --config /etc/mongodb.conf
.. or use a packaged install of MongoDB (such as for Redhat or Debian/Ubuntu) which will include a config file path in the service definition.
Note: to check the dbpath and command-line options for a running mongod
, connect via the mongo
shell and run:
db.serverCmdLineOpts()
In particular, if a custom dbpath
is set it will be the value of:
db.serverCmdLineOpts().parsed.dbpath // MongoDB 2.4 and older db.serverCmdLineOpts().parsed.storage.dbPath // MongoDB 2.6+
I have version 2.0.7 installed on Ubuntu and it defaulted to /var/lib/mongodb/
and that is also what was placed into my /etc/mongodb.conf
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With