【发布时间】:2013-02-08 00:03:35
【问题描述】:
我的 rails 应用程序中有一个 mongo 查询超时,因为集合很大。
FbCheckin.where(ext_fb_place_id: self.ext_fb_place_id).all
我从文档中了解到,您可以添加 timeout 选项以防止光标超时并显示以下消息:
Moped::Errors::CursorNotFound: The operation: "GET MORE" failed with error
我尝试了几种方法,包括
FbCheckin.where(ext_fb_place_id: ext_fb_place_id, {:timeout=>false}).all
和
FbCheckin.find(ext_fb_place_id: ext_fb_place_id, {:timeout=>false}).all
但这些都不能阻止光标超时。
有谁知道我如何进行此查询并收集所有FbCheckins 而不会事先光标超时?
谢谢
【问题讨论】:
-
这个discussion on the mongoid mailing list 可以提供一些有用的提示。
-
@PrakashMurthy 谢谢,我会看看这个
-
您找到解决方案了吗?
-
@cortex 不,我只是写了一个循环来一次提取批次。
标签: ruby-on-rails mongodb mongoid