I have a mongo collection in Rails where I use it this manner: collection.find(selector, options).to_a I have around 47K rows of data, and it seems very slow doing it this way. Should I be using the cursor instead of converting to an array? If so, can anyone point me to the usage pattern? Or, is using to_a fine? Just wondering if converting to an array is too slow. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Tue, Feb 26, 2013 at 10:22 AM, Edward Stembler <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have a mongo collection in Rails where I use it this manner: > > collection.find(selector, options).to_a > > I have around 47K rows of data, and it seems very slow doing it this > way. > > Should I be using the cursor instead of converting to an array? If so, > can anyone point me to the usage pattern? Or, is using to_a fine? Just > wondering if converting to an array is too slow.How about you tell us what ODM you are using? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Jordon Bedwell wrote in post #1099153:> On Tue, Feb 26, 2013 at 10:22 AM, Edward Stembler <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >> I have a mongo collection in Rails where I use it this manner: >> >> collection.find(selector, options).to_a >> >> I have around 47K rows of data, and it seems very slow doing it this >> way. >> >> Should I be using the cursor instead of converting to an array? If so, >> can anyone point me to the usage pattern? Or, is using to_a fine? Just >> wondering if converting to an array is too slow. > > How about you tell us what ODM you are using?I''m not sure what ODM stands for. I''m using the standard ruby driver for mongo; not MongoMapper or Mongoid. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.