Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
None
-
Fully Compatible
-
ALL
-
QE 2022-04-18
Description
db.b.find()
|
{ "_id" : ObjectId("62477ced76646eaf6616e9e3"), "k" : undefined } |
|
|
db.a.find()
|
{ "_id" : ObjectId("62477ce276646eaf6616e9e1"), "k" : [ ] } |
|
|
// no index on collection "a" -- no matches on "undefined"
|
db.b.aggregate({$lookup:{from:"a", localField:"k", foreignField:"k", as:"matched"}}) |
{ "_id" : ObjectId("62477ced76646eaf6616e9e3"), "k" : undefined, "matched" : [ ] } |
|
|
// after creating the index, "undefined" starts matching empty arrays
|
db.a.createIndex({k:1}) |
db.b.aggregate({$lookup:{from:"a", localField:"k", foreignField:"k", as:"matched"}}) |
{ "_id" : ObjectId("62477ced76646eaf6616e9e3"), "k" : undefined, "matched" : [ { "_id" : ObjectId("62477ce276646eaf6616e9e1"), "k" : [ ] } ] } |
While we've been given green light to do "whatever" for undefined, it's a little concerning that the results aren't consistent across the join types...