【发布时间】:2021-04-03 05:57:43
【问题描述】:
您好,我似乎无法让排除 _id 工作,这是代码
const findLabels = (db, cb) => {
// Get the documents collection
const collection = db.collection(documentName);
// Find some documents
collection.find({}, { _id: 0 }).toArray((err, docs) => {
// An error occurred we need to return that to the given
// callback function
if (err) {
return cb(err);
}
assert.equal(err, null);
console.log("Found the following records");
console.log(docs)
return cb(null, docs);
});
}
这是控制台日志的输出
Found the following records
[ { _id: 5a5ee78cc130e727a3b1fdb6, name: 'Downgradeklajds' },
{ _id: 5a5ee794c130e727a3b1fdb7, Pizel: '00:00:07' } ]
我哪里做错了?
【问题讨论】: