Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6050

Consider allowing $elemMatch applied to non arrays

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Querying

    Description

      Currently $elemMatch can only be applied to an array. For example { a:{ $elemMatch:{ $gte:1, $lte:10 } } } will match { a:[ 5 ] } but not { a:5 }. This is a bit awkward in a case like { 'a.b':{ $elemMatch:{ $gte:1, $lte:10 } } } and a document { a:[ { b:5 }, { b:15 } ] }. The document will not match because the b values are not arrays, even though there could be multiple values of 'a.b'.

      Attachments

        Activity

          People

            david.storch@mongodb.com David Storch
            aaron Aaron Staple
            Votes:
            16 Vote for this issue
            Watchers:
            22 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: