What's the difference between the two commands here?
db.collection.deleteMany({condition})
db.collection.remove({condition})
What's the difference between the two commands here?
db.collection.deleteMany({condition})
db.collection.remove({condition})
据我所知,
db.收集删除许多
Returns:
A document containing:
> A boolean acknowledged as true if the operation ran with write concern or false if write concern was disabled
> deletedCount containing the number of deleted documents
REF: db.收集删除许多
在哪里
db.收集go 除
return WriteResult
And to remove a single document, there a similar command, db.收集go 除One
where as with db.收集go 除
you need to set and option called justOne
option to limit delete to 1 document.
否则我猜他们是相似的.
node .js驱动程序
When talking about node .js驱动程序
, remove
has been deprecated (and may be removed in future releases) and deleteOne
or deleteMany
.
希望这有意义....