[英]How can a find() access a document field for an operation? (MongoDB, nodeJS)
hello I would like to know if daily_price > = price_clic * number_view你好我想知道daily_price > = price_clic * number_view
Model.find({
daily_price: {
$gte: price_clic * number_view
}
})
const schema = mongoose.Schema({
price_clic: { type: Number, required: true },
number_view: { type: Number, required: true, default: 0 },
daily_price: { type: Number, default: 0 },
})
thank you so much太感谢了
The following code solved my problem:以下代码解决了我的问题:
$expr: {
$gte: [
"$daily_price", { $multiply: ["$price_clic", "$number_view"] },
],
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.