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

$elemMatch results not a subset of non $elemMatch results when there are missing values

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      None

      > c.drop();
      true
      > c.save( {a:[

      {b:1}

      ,{}]} )
      > c.find(

      {'a.b':null}

      )
      > c.find( {a:{$elemMatch:

      {b:null}

      }} )
      { "_id" : ObjectId("4e13d80b82517cd82873bc17"), "a" : [

      { "b" : 1 }

      , { } ] }

      Don't know if this is desired or not, thought I would check.

      Also, the behavior is different from the above if the field missing 'b' is not an object:

      > c.drop()
      false
      > c.save( {a:[

      {b:1}

      ,'z']} )
      > c.find(

      {'a.b':null}

      )
      > c.find( {a:{$elemMatch:

      {b:null}

      }} )
      >

            Assignee:
            Unassigned Unassigned
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: