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

Consider allowing $elemMatch applied to non arrays

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 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

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: