【发布时间】:2012-03-23 14:53:21
【问题描述】:
mongoengine(在 python 中)存在内存问题。
假设我有大量的 custom_documents(几千个)。 我想处理它们,像这样:
for item in custom_documents.objects():
process(item)
问题是custom_documents.objects() 加载内存中的每个对象,而我的应用程序使用了几个 GB ...
我怎样才能让它更明智? 有没有办法让 mongoengine 懒惰地查询数据库(它在我们迭代查询集时请求对象)?
【问题讨论】:
标签: python mongodb lazy-evaluation mongoengine