Scopes on embedded docs sometimes attempt to query non-embedded collection, incorrectly returning empty/0 results

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 5.1.0
    • Affects Version/s: 5.0.1, 5.1.0
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When building queries for embedded documents, if one scope calls another that uses an order_by(), then the query acts as if the embedded document is not embedded and queries for the non-existant collection.

      See attached example code. Log entries showing the incorrect queries against "insides" are also generated.

      Including the order_by() in the parent scope works correctly.

      Tested and confirmed as broken in 5.0.1, 5.0.0-stable, and master. Worked in Mongoid 4.

            Assignee:
            Emily Stolfo (Inactive)
            Reporter:
            thomas morgan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: