Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5516

Post.all returns a Mongoid::Criteria rather than a result set

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Docs
    • Labels:

      In the Rails Console, calling Post.all with Active Record returns an arrray of blog posts. With Mongoid, Post.all returns a Mongoid::Criteria object instead. You must call Post.all.to_a to execute the query and iterate the results. We should call out the need for to_a (or similar method) clearly in our documentation.

            Assignee:
            dmitry.rybakov@mongodb.com Dmitry Rybakov
            Reporter:
            james.kovacs@mongodb.com James Kovacs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: