0

I'm running the latest version on Docker(Mongodb server 7.0.11), and I'd like to know: Are there any mechanisms to limit the size of a single database on MongoDB? Or perhaps a way to impose a storage quota on a particular user?

8
  • Have you tried to use the parameters --smallfiles and --quotafiles in conjunction with -quota?
    – M. Behrens
    Commented Jun 2 at 18:29
  • @M.Behrens , I saw that on an old post( link ), but that would rather affect the server instance globally, and besides, it has one other shortcoming, what if I wanted to delegate different sizes/quotas to different databases/users? Commented Jun 2 at 23:48
  • 1
    There are Capped Collections (in MongoDB a set of collections make a database). These allow fixed-size collections.
    – prasad_
    Commented Jun 3 at 2:51
  • @prasad_ , seems not to work with gridfs collections. It shows the ".chunks" collection as "capped": true, and "maxSize" as I set with "convertToCapped"(to 32 megabytes), "max" : -1, however I can still keep adding stuff, and it will not put on the breaks. The "size" property stopped increasing very closed to the value I set as "maxSize", just shy of surpassing it, however, "storageSize" keeps increasing as I add more files(It's close to 50 megabytes and the bucket keeps accepting new files). Commented Jun 3 at 8:22
  • May be it doesn't work well with GridFS (see Is it possible to Cap a GridFS collection?). You may want to add more details about your requirement / question so that you could get more responses.
    – prasad_
    Commented Jun 3 at 8:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.