Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit MongoDB database size?

Tags:

mongodb

We're interested in deploying MongoDB, but we need to know if we can limit database/table sizes?

For example:

db.user1.find() db.user2.find()

As you can see from the above, each user will have their own database. We want to limit each user's database so we don't have any one user eating up all our hard drive space.

Is this possible with MongoDB?

Thanks.

like image 298
rogj Avatar asked Feb 20 '11 01:02

rogj


2 Answers

You can create a database per user and enable the --quota option. This will allow you keep any user from using too much space.

http://docs.mongodb.org/manual/reference/program/mongod/#core-options

http://docs.mongodb.org/manual/faq/storage/#faq-disk-size

like image 146
Scott Hernandez Avatar answered Oct 15 '22 22:10

Scott Hernandez


Try to

db.createCollection("mycoll", {size:100000})
like image 41
Falcon Avatar answered Oct 15 '22 22:10

Falcon