2013-02-10 35 views
0

當我運行rake任務時,出現以下錯誤。誰能幫我?rake中止!操作:「GET MORE」

錯誤

rake aborted! 
The operation: "GET MORE" 
failed with error "cursor 178700246530 not found" 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/moped-1.3.2/lib/moped/node.rb:210:in `get_more' 

我耙代碼

MyCollection.where(:name => "abc").each do |comp| 
l =  open(comp.logo_url) 
comp.logo = l 
comp.save! 
end 

在此先感謝

+0

MyCollection是巨大的嗎?這很可能是這種情況。請訪問https://groups.google.com/forum/?fromgroups=#!topic/mongoid/9QxJZg9sSZo – 2013-02-10 05:36:50

+0

查看關於此錯誤的相關討論。是的,它很大。有沒有辦法處理這個問題? – Muzaffer 2013-02-10 06:22:25

回答

-2

嘗試find_in_batches您的藏品使用。

+0

我沒有使用find_in_batches,但修改了代碼以便一次使用有限的數據。它工作沒有錯誤。由於從數據庫中檢索大量數據,因此發生錯誤部分時間檢索數據並執行活動。 – Muzaffer 2013-02-11 05:21:29

+0

MyCollection.where(:name =>「abc」)。limit(50).each do | comp | l = open(comp.logo_url) comp.logo = l comp.save! 結束 – Muzaffer 2013-02-12 05:47:40

+1

#find_in_batches不是Mopped方法。它只是ActiveRecord – shingara 2013-10-11 07:34:50