mongomock
mongomock copied to clipboard
Small library for mocking pymongo collection objects for testing purposes
Considering the following document: ``` { "username": "nickolasaperes", "name": "Nickolas", "info": { "last_access": "today", "is_first_access": False, "is_admin": True, "is_customer": False } } ``` and the aggregation: ``` [ { "$project":...
Great library Pascal and team! I'm trying to use mongomock as a test backend through [mongoengine](https://github.com/MongoEngine/mongoengine) but the lack of custom TypeRegistry support makes it impossible. This is a continuation...
The 'bulk_write' behavior in 'mongomock' is not working as expected. When I execute the following test using pymongo... ``` from dataclasses import dataclass from datetime import datetime from enum import...
Latest version of pymongo has an optional `comment` param in the `insert_one` signature https://github.com/mongodb/mongo-python-driver/blob/a3720d9ceaa699e196fc1624f4c62515c2e5410d/pymongo/collection.py#L578. Code that uses this parameter will crash when tested with mongomock ```bash > return self.db_col.insert_one( document=document,...
Some external libraries (mongoengine is one example), depend on the insertion order of the fields in the dict returned by pymongo, specifically in this fix that the "_id" field is...
Newer versions of pymongo have overloaded the __bool__ for the Database object (database.py, near end of file) with the following code to not allow treating it as a NULL ,...
An instance of `mongomock.MongoClient` appears to be independent to any other instances. This results in different behaviour from a real `pymongo.MongoClient`, which would access the same underlying database. Is this...
When mongomock `$group` query encounters a missing property it nullifies the entire object in contrast to mongomock which only skips missing properties. ```python import pymongo import mongomock client = pymongo.MongoClient()...
### What this PR does - This is the following PR of https://github.com/mongomock/mongomock/pull/791 - This will resolve the issue that has $expression in `timezone` field. ### related ticket https://github.com/mongomock/mongomock/issues/783#issuecomment-1346831812
Add [$setWindowFields](https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields) operator Currently supports only `$shift` and doesn't support `'window'` field. You are welcome to build on top of my code more functionality. Partially fixes #806