mongomock
mongomock copied to clipboard
Small library for mocking pymongo collection objects for testing purposes
When I execute somthing like ```python code = """ (function (text) { return true }) """ mydb["mycollection"].find({ "$expr": { "$function": { "body": code, "args": ["$text"], "lang": "js", } } })...
Hi, I'm using mongomock==4.1.2. It seems that "explain" attribute is not added for cursors in mongomock. We are using the code: ` if document.explain()["executionStats"]["nReturned"] == 0: ` In the production,...
Extracted from https://github.com/mongomock/mongomock/pull/737 I select the commits required for $setIntersection implementation
When I execute somthing like ```python mydb["mycollection"].find({"$text": {"$search": {"name": "hallo"}}}) ``` I get the following exception: ``` NotImplementedError: The $text operator is not implemented in mongomock yet ``` I would...
I tried to maintain the database between instances, here follow my test. How I use this _store argument? ## Expected - I can pass the '_store' argument, so it can...
Adds a [$setIsSubset](https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIsSubset/) operator. Hadles nested sets with unhashable types (mongodb allows comparing lists and dicts so we turn those to `helpers.hashdict` and tuples instead).
Added support to mongo's `$type` operator for: - int - long - bool - string - object - null - missing
A feature request for MongoDB's [$type](https://www.mongodb.com/docs/manual/reference/operator/aggregation/type/) operator
https://github.com/mongomock/mongomock/blob/ca41f27161c50d83d5ef8c899623084dd6f09a1d/mongomock/collection.py#L872 There is seemingly no way to override this value, even though the method signature defaults the check_keys to false. def _update(self, spec, document, upsert=False, manipulate=False, multi=False, **check_keys=False**, hint=None, session=None,...
Hello. While trying to run aggregations that use the commands $round, $isnumber and $reduce, I received an exception that they are not supported. When will they be supported? How can...