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

using $elemMatch projection with $all gives unexpected results

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.0-rc0, 2.6.3
    • Component/s: Querying
    • Labels:
      None
    • ALL

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: