mongomock icon indicating copy to clipboard operation
mongomock copied to clipboard

Small library for mocking pymongo collection objects for testing purposes

Results 194 mongomock issues
Sort by recently updated
recently updated
newest added

i'm using the latest version but i'm getting following error: Although 'let' is a valid lookup operator for the aggregation pipeline, it is currently not implemented in Mongomock."

When I use $where in a find query, such as: mydb["mycollection"].find({"$where": f"this.files.filter(f => f.path.endsWith('.txt')).length >= 3"}) I get the NotImplementedError exception to state that $where operator is not yet supported...

Mongomock uses [setuptools](https://github.com/mongomock/mongomock/blob/ca41f27161c50d83d5ef8c899623084dd6f09a1d/mongomock/__version__.py#L1) unconditionally. However, setuptools (which provides `pkg_resources`) is not stdlib, and it is not guaranteed to be there. So it needs to be specified as a dependency, otherwise...

## Problem I am creating a compound index and specifying that items should be sorted in descending order by age. Mongomock does not seem to honor the sort order of...

mongomock doesn't support $toString in projection but mongodb supports it

I am using the aggregation pipeline below which results in success with pymongo itself. With mongomock there is the error message `TypeError: int() argument must be a string, a bytes-like...

So, MongoDB allows using indexes on lists like this: ```python collection.create_index("mike.first", unique=1) collection.insert_one({"mike": [{"first": "value"}]}) collection.insert_one({"mike": [{"first": "value"}]}) ``` [Link to documentation](https://www.mongodb.com/docs/manual/core/index-unique/#unique-compound-index) This will not work in MongoDB because both...

Hi all, any chance that a new release will be published soon? I see that a lot of issues were resolved but not merged into the library. And a year...

This fixes the bug with the `$each` modifier in `$addToSet`. (Closes #846) Just replacing the list comprehension with a loop seems to be the most straightforward way to solve this...

Using the `$each` modifier with `$addToSet` doesn't always result in unique values because of how the values of the `$each` are handled: https://github.com/mongomock/mongomock/blob/ca41f27161c50d83d5ef8c899623084dd6f09a1d/mongomock/collection.py#LL704C37-L706C80 Example: ```py import mongomock client = mongomock.MongoClient()...