我有这个 Controller :
Model.find().sort('date').limit(6).exec(function(error, result) {
if (error) {
console.log(error);
}
else {
res.send(result);
}
});
在我的架构中,我有一个 tof 字段(true 或 false),并且我只想提取 tof 字段中值为 true 的 6 个文档,这可能吗?
最佳答案
你尝试过吗
Model.find({tof: true}).sort('date').limit(6)
关于javascript - 如何仅提取 6 个文档且字段中的值为 true?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28598034/