| Steps To Reproduce: |
db.inventory.insertMany([
|
{ item: "journal", instock: [ { warehouse: "A", qty: 5 } , { warehouse: "C", qty: 15 } ] },
|
{ item: "notebook", instock: [ { warehouse: "C", qty: 5 } ] },
|
{ item: "paper", instock: [ { warehouse: null, qty: 60 } , { warehouse: "B", qty: 15 } ] },
|
{ item: "planner", instock: [ { warehouse: "A", qty: 40 } , { warehouse: "B", qty: 5 } ] },
|
{ item: "postcard", instock: [ { qty: 15 } , { warehouse: "C", qty: 35 } ] }
|
]);
|
- Note that third document has warehouse:null in the first embedded doc and the fifth document has the first embedded doc with no warehouse field.
db.inventory.find( { 'instock.0.warehouse': null } )
Returns all five documents where I would expect it to return only third and fifth documents.
|