[英]Dynamic Match Query MongoDB
How would I write one of these expressions dynamically with a variable in nodejs or typescript? 如何在nodejs或Typescript中使用变量动态编写这些表达式之一?
$match: {
date: '9-8-2019',
"info.tag": "Test"
}
or 要么
$match: {
$expr: {
$and:[ { $eq: ["$price_id", "$$id"]}, { $eq: ["$tag", "Test"] }]
}
}
Try with the help of this 试试这个
$match: {
id: req.body.id,
$and: [{
createdAt: {
$gte: new Date(start)
}
}, {
createdAt: {
$lte: new Date(end)
}
}]
}, },
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.