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

using $elemMatch projection with $all gives unexpected results

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.2.0-rc0, 2.6.3
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Operating System:
      ALL

      Description

      When using $all, it results in x not appearing in the results

      for ( i = 0; i < 100; i++ ) {
          t.insert({ group: 1, x: [ 1, 2, 3, 4, 5 ] });
      }
      > t.find( { group:1 }, { _id : 0, x: { $elemMatch: { $all:[1, 2, 3] } } } ).limit(1)
      { }

      May be better to uassert instead.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              jeff.yemin Jeffrey Yemin
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: