MongoDB上限集合允许的最大大小

use*_*628 3 mongodb pymongo

我正在使用一个可以使用的mongodb上限集合.我想将其大小设置为最大值,因为我不希望根据FIFO规则删除最旧的记录.

我希望尽可能长时间地保持数据,同时保持封顶集合的功能.

谢谢

Joh*_*yHK 6

您可以根据需要设置上限集合; 只需将size参数设置为create_collection足够大的值,以免空间不足.

像这样:

 db.create_collection('captest', capped=True, size=20000000000)
Run Code Online (Sandbox Code Playgroud)