Raz*_*Raz 6 crud mongoose mongodb
我在 MongoDB 上有一个名为“权限”的集合。我想实现一个这样的简单更新:
let schema = new Schema({
title: String
});
let Permissions = mongoose.model("Permission", schema);
let permission = new Permissions();
let query = {};
let newValues = {
$set: {
title: "Yes"
}
};
permission.updateOne(query, newValues, (err, docs) => {
console.log(err); // null
console.log(docs); // { ok: 0, n: 0, nModified: 0 }
if (err) return cast.error(err);
return cast.ok();
});
Run Code Online (Sandbox Code Playgroud)
不过,我收到{ ok: 0, n: 0, nModified: 0 }在控制台日志docs
和null在控制台日志err。
我究竟做错了什么?
| 归档时间: |
|
| 查看次数: |
5945 次 |
| 最近记录: |