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

Criteria with #matches keys aren't merged

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 3.0.0
    • Component/s: None
    • Labels:

      Description

      The #matches criteria are overwritten instead of being merged

      Post.where(:comments.matches => {author: /asdf/}).
           where(:comments.matches => {body: /asdf/})
      # => #<Mongoid::Criteria
      #  selector: {:comments=>{"$elemMatch"=>{:body=>/asdf/}}},
      #  options:  {},
      #  class:    Post,
      #  embedded: false>
       
      Post.where(:comments.matches => {body: /asdf/}).
           where(:comments.matches => {author: /asdf/})
      # => #<Mongoid::Criteria
      #  selector: {:comments=>{"$elemMatch"=>{:author=>/asdf/}}},
      #  options:  {},
      #  class:    Post,
      #  embedded: false>
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: