Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectID differ between mongodb and mongo-mock #95

Open
cscetbon opened this issue Mar 29, 2019 · 1 comment
Open

ObjectID differ between mongodb and mongo-mock #95

cscetbon opened this issue Mar 29, 2019 · 1 comment

Comments

@cscetbon
Copy link

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 ...

@Downchuck
Copy link

Downchuck commented Apr 14, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants