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

    XMLWordPrintable

Details

    • Question
    • Status: Closed
    • Major - P3
    • Resolution: Works as Designed
    • None
    • None
    • Querying
    • None

    Description

      > 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}

      }} )
      >

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: