1
是否可以撥打MongoDB
find()
方法,並獲得截然不同的記錄?或者我應該循環結果集?MongoDB find()可以返回不同的記錄嗎?
collection.find({
'recordType' : recordType,
'date' : {
$gte : new Date(dateFrom)
},
'operation' : 'delete'
}, {
fields : {
'date' : 0,
'operation' : 0
}
}).toArray(function (err, results) {
jsonResult.push(results);
response.write(JSON.stringify(jsonResult));
response.end()
});
您將只獲得與您正在查找的查詢相匹配的記錄。 – Shrabanee
您是否想通過使用'{fields:{'date':0,'operation':0}}'來投影'date'和'operation'字段? – Shrabanee
您能添加預期的文檔示例嗎? – profesor79