Incremental queries on associated objects

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor - P4
    • 10.0.0
    • Affects Version/s: None
    • Component/s: Associations, Query
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hi!

      I was trying to do an incremental or query on an associated object, and the resulting query was not what I expected, and I wondered if it was intentional.

      band.
        members.
        or(active: true).
        or(retired: true)
      
      => #<Mongoid::Criteria
        selector: {"$or"=>[{"band_id"=>BSON::ObjectId('652f51ec236b7a3e02183c0c')}, {"active"=>true}, {"retired"=>true}]}
        options:  {}
        class:    Member
        embedded: false>
      

      I was expecting the band_id criteria to be added to each of the array elements. Is there any way to do what I'm looking for? Or would this be considered a bug?

      Thanks!

            Assignee:
            Jamis Buck
            Reporter:
            Dmitry Rybakov
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: