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

Criteria#each returns BSON::Document instead of Model document

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Critical - P2 Critical - P2
    • 12_01_17
    • Affects Version/s: 5.1.0, 5.1.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Rails 4.2.5; mongo 3.2.1

      I have a model named Booking; in the first request I save a new booking (booking.save!); in the following request (i.e.: index or show) doing Booking.all.to_a returns an array of BSON::Document objects which is obviously wrong. If I restart the Rails server, Booking.all.to_a returns an array of Booking object which is the right thing. Same happens with #where and #each. I tried to debug it but I couldn't find the cause. Any hint is well appreciated.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            steookk Stefano Uliari
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: