Closed purefan closed 4 years ago
The 2nd parameter is a projection (an object that says which fields to return). Your query's 2nd parameter tries to sort ... mongo-mock is getting confused with it.
https://docs.mongodb.com/manual/reference/method/db.collection.findOne/
I suspect real mongo isn't sorting and is just ignoring it..? not sure.
I changed the way I was querying based on your feedback and it works now, I havent confirmed that mongo wasnt sorting but I expected an error from mongo, it just never came and I thought my code was fine.
Thanks for your feedback! loving the project <3
Hey guys!
Loving the project, it allows me to really test my express app from a mocha testsuite but today I ran into an issue when I was refactoring, this query:
works against a normal mongo database, but in mongo-mock it fails with:
Is it something Im doing wrong?