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?

asked Jun 2, 2024 at 17:06
8
  • Have you tried to use the parameters --smallfiles and --quotafiles in conjunction with -quota? Commented Jun 2, 2024 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, 2024 at 23:48
  • 1
    There are Capped Collections (in MongoDB a set of collections make a database). These allow fixed-size collections. Commented Jun 3, 2024 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, 2024 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. Commented Jun 3, 2024 at 8:52

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.