mongomock
mongomock copied to clipboard
Small library for mocking pymongo collection objects for testing purposes
In my application, I use slotted classes implementing `MutableMapping` with mongo database for performance reasons. However, even though those objects can be stored in the database, mongomock is unable to...
Adds support for update $bit https://www.mongodb.com/docs/manual/reference/operator/update/bit/
Using mongomock for unit testing, I stumpled upon this: `NotImplementedError: Using the $rename operator with dots is a valid MongoDB operation, but it is not yet supported by mongomock` This...
When retrieving a document using a `$slice` projection, modifying the dictionary automatically causes changes in the doc when retrieving it later. I find this unexpected, and led me to spend...
When including a sort key to the find_one_and_update function, while excluding the "_id" with a projection, find_one_and_update will find the document with sorting, but will update a different document. Here's...
Setup: * python: 3.10.12 (fresh virtual environment) * `pip==24.2` * `pymongo==4.9.1` * `mongomock==4.2.0.post1` To reproduce the error these two lines of code are necessary: ```python In [1]: import mongomock.gridfs In...
Setting a limit on a cursor and retrieving items until the limit is reached will result in `.alive()` to return `False`, however not with the mongomock implementation, as it checks...