Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB Capped Collection Maximum allowable size

I'm using a mongodb capped collection which is tailable. I want to set the size of it to a maximum value as I don't want to really have the oldest records removed according to the FIFO rule.

I want the data to pesist for as long as possible whilst keeping the features of a capped collection.

Thanks

like image 376
user94628 Avatar asked Aug 31 '26 23:08

user94628


1 Answers

You can make the capped collection as big as you want; just set the size parameter of create_collection to a value big enough to not run out of space.

Like this:

 db.create_collection('captest', capped=True, size=20000000000)
like image 118
JohnnyHK Avatar answered Sep 03 '26 13:09

JohnnyHK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!