Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are the db files? at /var/lib/mongodb I cant find any increase in size. I ran very big loop to create lakhs of objects

Tags:

mongodb

I am using UBUNTU, from /etc/mongod.conf, I found that /var/lib/mongdb is the path for data.

I have found some files like collectionname.0, .1, .ns in that directory. but when I run a very big loop(lakhs), I am able to get them back using mongo shell, but that mongodb directory size is not increasing, so there must be someother place where this data is being stored

What is that place?

like image 998
user1653509 Avatar asked Oct 07 '22 07:10

user1653509


1 Answers

There is no another place. As indicated by @itsbruce, in Ubuntu it's /var/lib/mongodb.

On a non-packaged installation (on Linux), i.e. without a /etc/mongodb.conf file, the default is /data/db/ (unless otherwise specified).

You can modify the switch "--dbpath" on the command line to designate a different directory for the mongod instance to store its data. Typical locations include: /srv/mongodb, /var/lib/mongodb or /opt/mongodb.

(Windows systems use the \data\db directory.) If you installed using a package management system.

I recommend using the db.collection.stats command as outlined here to monitor the size of your collection as you insert data. The link also explains what each field (in the output) means.

like image 84
Mark Hillick Avatar answered Oct 10 '22 04:10

Mark Hillick