-
Type:
Bug
-
Resolution: Gone away
-
Priority:
Minor - P4
-
Affects Version/s: 4.6
-
Component/s: None
-
None
Detailed steps to reproduce the problem?
Example provided in Mongo documentation does not work.
Link below:
Steps to reproduce::
try:
db.orders.insert_many( [
{ "_id" : 1, "item" : "almonds", "price" : 12, "ordered" : 2 },
{ "_id" : 2, "item" : "pecans", "price" : 20, "ordered" : 1 },
{ "_id" : 3, "item" : "cookies", "price" : 10, "ordered" : 60 }
] )
db.warehouses.insert_many( [
{ "_id" : 1, "stock_item" : "almonds", "warehouse": "A", "instock" : 120 },
{ "_id" : 2, "stock_item" : "pecans", "warehouse": "A", "instock" : 80 },
{ "_id" : 3, "stock_item" : "almonds", "warehouse": "B", "instock" : 60 },
{ "_id" : 4, "stock_item" : "cookies", "warehouse": "B", "instock" : 40 },
{ "_id" : 5, "stock_item" : "cookies", "warehouse": "A", "instock" : 80 }
] )
except BaseException as e:
print(e)
print(list(db.orders.aggregate( [
{
"$lookup":
,
"pipeline": [
{ "$match":
{ "$expr":
,
{ "$gte": [ "$instock", "$$order_qty" ] }
]
}
}
},
{ "$project":
}
],
"as": "stockdata"
}
}
] )))
As you will see, stockdata field will be empty.
The exact Python version used, with patch level:
3.11.4 (main, Jun 7 2023, 10:13:09) [GCC 12.2.0]
The exact version of PyMongo used, with patch level:
4.6.0.dev0
True
The operating system and version (e.g. Windows 7, OSX 10.8, ...)
Linux b314816f84cf 6.2.0-25-generic #25-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 16
17:05:07 UTC 2023 x86_64 GNU/Linux