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

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • 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
              Reporter:
              Aaron Staple (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: