mongo-mock
mongo-mock copied to clipboard
ObjectID differ between mongodb and mongo-mock
I'm testing some code that uses mongodb to find/update/delete objects looking them up by their _id. However as the tested code uses require('mongodb').ObjectID and mongo-mock uses a different version of it, the tested code can't find the objects. This is really annoying ...
Noticing for myself that overriding ObjectID would be valuable in that I could make it deterministic for snapshots. This ObjectID is bson-objectid, in mongodb it is mongodb-core.BSON.ObjectID
I can see theres a pkFactory in CollectionState in db.js but it's not used by create_backingstore.