文档说明了Model::remove()
方法:
从集合中删除所有符合条件的文档。要仅删除符合条件的第一个文档,请将单个选项设置为 true。
问题是如何设置这个选项?
我试过了:
1) Model.remove({code: 55, single: true }, function (err, deleted) {...
— 没有结果,因为正如我所料,single
在这种情况下被视为一个不存在的字段;
2) Model.remove({code: 55}, {single: true }, function (err, deleted) {
— TypeError: callback.apply is not a function
.
我是猫鼬初学者,在此先感谢您的帮助。