Open LucVidal360 opened 1 year ago
It seems deleteMany never deletes anything. Indeed, it's algorithm is:
deleteMany
Unfortunately
lodash.includes
SameValueZero
This means ids never match (because they are not the same instance of ObjectIds), and nothing is ever deleted.
ObjectId
A solution could be to add a secret option to cursor to avoid cloning documents. To use only with deleteMany.
Problem
It seems
deleteMany
never deletes anything. Indeed, it's algorithm is:Unfortunately
lodash.includes
which usesSameValueZero
: https://github.com/williamkapke/mongo-mock/blob/80fdc61faee03e0668b89eca454c73a9efd864ee/lib/collection.js#L132This means ids never match (because they are not the same instance of
ObjectId
s), and nothing is ever deleted.Possible fix
A solution could be to add a secret option to cursor to avoid cloning documents. To use only with
deleteMany
.