0

I am getting the below error when I run the rake task. Can any one help me?

Error

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'

My Rake Code

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

Thanks in advance

Prakash Murthy
  • 12,923
  • 3
  • 46
  • 74
Muzaffer
  • 196
  • 1
  • 5
  • 13
  • Is the `MyCollection` huge? That would most likely be the case. Check out the related discussion about this error at https://groups.google.com/forum/?fromgroups=#!topic/mongoid/9QxJZg9sSZo – Prakash Murthy Feb 10 '13 at 05:36
  • Yes it is huge. is there any possible way to handle this? – Muzaffer Feb 10 '13 at 06:22

1 Answers1

-2

Try to use with find_in_batches with your collection .

AnkitG
  • 6,438
  • 7
  • 44
  • 72
  • I have not used find_in_batches but code modified to use limited data at a time. It works without error. Error occur because of huge data retrieval from DB. Retrieve data partially at time and perform activity. – Muzaffer Feb 11 '13 at 05:21
  • MyCollection.where(:name => "abc").limit(50).each do |comp| l = open(comp.logo_url) comp.logo = l comp.save! end – Muzaffer Feb 12 '13 at 05:47
  • 1
    #find_in_batches is not a Mopped Method. It's ActiveRecord only – shingara Oct 11 '13 at 07:34