Where can i find mongodb files?
My host came with a mongodb instance and there is no /db directory so now I am wondering what I can do to find out where the data is actually being stored. Show
asked Aug 30, 2011 at 17:44
Aaron SilvermanAaron Silverman 21.4k21 gold badges79 silver badges102 bronze badges 4
If you run
erip 15.8k10 gold badges63 silver badges118 bronze badges answered Sep 2, 2011 at 18:00
6 What does your configuration file say?
If it is not correct, try this, your database files will be present on the list:
It's Note that there is also a answered Aug 30, 2011 at 17:53
Tomasz NurkiewiczTomasz Nurkiewicz 328k68 gold badges691 silver badges667 bronze badges 3 I find Also in my case it was important to make sure that the config value reflects the actual value (i.e. config didn't change after the last restart), which isn't guaranteed by the solutions offered here.
Example output:
answered Aug 27, 2018 at 9:15
glock18glock18 6205 silver badges11 bronze badges 2 In the newer version of mongodb v2.6.4 try:
It will give you something like this:
And that is where it stores the data. answered Aug 28, 2014 at 10:19
Tim TrustonTim Truston 4,1306 gold badges46 silver badges59 bronze badges 1 While this question asks about Linux/Unix instances of Mongo, it's one of the first search results regardless of the operating system used, so for future Windows users that find this: If MongoDB is set up as a Windows Service in the default manner, you can usually find it by looking at the 'Path to executable' entry in the MongoDB Service's Properties: answered Sep 23, 2016 at 2:34
RobotnikRobotnik 3,4962 gold badges31 silver badges47 bronze badges 2 From my experience the default location is
lrineau 5,7683 gold badges33 silver badges46 bronze badges answered Jan 6, 2015 at 16:49
zillabunnyzillabunny 3353 silver badges10 bronze badges 1 Actually, the default directory where the mongod instance stores its data is
To check the same, you can look for dbPath settings in mongodb configuration file.
The default mongod.conf configuration file included with package manager installations uses the following platform-specific default values for
The The Linux package init scripts do not expect Source answered Feb 10, 2017 at 14:35
1 I found mine here on a OSX system /usr/local/var/mongodb answered Jun 18, 2016 at 11:38
2 For windows Go inside MongoDB\Server\4.0\bin folder and open mongod.cfg file in any text editor. Then locate the line that specifies the dbPath param. The line looks something similar
answered Jan 22, 2019 at 9:28
Found it just by poking around in answered Sep 5, 2011 at 20:26
Aaron SilvermanAaron Silverman 21.4k21 gold badges79 silver badges102 bronze badges If you could somehow locate mongod.log and the do a grep over it
The value for dbpath is the data location for mongodb!! All the best :) answered Sep 7, 2017 at 12:35
NilotpalNilotpal 2,8934 gold badges30 silver badges46 bronze badges On MongoDB 4.4+ and on CentOS 8, I found the path by running:
answered Dec 30, 2020 at 0:36
jjjjjj 2,4644 gold badges33 silver badges57 bronze badges When you start it up it shows you. But I don't know if it is something you can do or not on your host. If you have access to the command line and can restart the service, you will get something like:
answered Nov 15, 2016 at 17:59
johnnyjohnny 19k49 gold badges152 silver badges254 bronze badges Where are MongoDB files stored?MongoDB requires a data folder to store its files. The default location for the MongoDB data directory is c:\data\db.
How do I view files in MongoDB?In MongoDB, find() method is used to select documents in a collection and return a cursor to the selected documents. Cursor means a pointer that points to a document, when we use find() method it returns a pointer on the selected documents and returns one by one.
How do I find my MongoDB database?In MongoDB, you can use the show dbs command to list all databases on a MongoDB server. This will show you the database name, as well as the size of the database in gigabytes. You can select any database using the use statement and work on it.
How do I list all files in MongoDB?Using Java program
Create a MongoDB client by instantiating the MongoClient class. Connect to a database using the getDatabase() method. Get the object of the collection from which you want to retrieve the documents, using the getCollection() method.
|