| Steps To Reproduce: |
> db.local.insertMany([{_id: 0, key: 1},{_id: 1, key: 2}])
|
|
> db.createCollection("foreign", { timeseries: { timeField: "time", metaField: "meta", granularity: "minutes" }})
|
> db.foreign.insertMany([{time: new Date(), _id: 0, meta: 1, val1: 42, val2: 100},{time: new Date(), _id: 1, meta: 2, val1: 17, val2: 100}])
|
|
db.local.aggregate(
|
{$lookup: {
|
from: "foreign",
|
let: {lkey: "$key"},
|
pipeline: [
|
{$match: {$expr: {$lt: ["$val1","$val2"]}}},
|
{$match: {$expr: {$eq: ["$meta","$$lkey"]}}},
|
{$project: {lkey: "$$lkey",fkey: "$meta",val: "$val1",_id: 0,}},
|
],
|
as: "joined"
|
}}
|
)
|
The result is:
|
{ "_id" : 0, "key" : 1, "joined" : [ { "lkey" : 1, "fkey" : 1, "val" : 42 } ] }
|
{ "_id" : 1, "key" : 2, "joined" : [ { "lkey" : 1, "fkey" : 1, "val" : 42 } ] }
|
The match on the local record with key=2 is wrong.
|
| Sprint: |
QI 2023-10-16, QI 2023-10-30, QI 2023-11-13, QI 2023-11-27, QI 2023-12-11, QI 2023-12-25, QI 2024-01-08, QI 2024-01-22 |