我有一个使用mongo驱动程序"mongodb": "^3.1.1"
的节点应用程序。
https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/#node-js-driver-compatibility
在查询中,我想使用$lookup
和let
语法的pipeline
。
但是它给出了{ MongoError: arguments to $lookup must be strings, let: { holiday: "$name" } is type object
我的查询
{
$lookup:
{
from: "Holidays",
let: {holiday: "$name"},
pipeline: [
{ $match: { year: 2018 } },
{ $project: { _id: 0, date: { name: "$name", date: "$date" } } },
{ $replaceRoot: { newRoot: "$date" } }
],
as: "holidays"
}
}