Merge pull request #2264 from Pacu2/2263/combining-raw-and-regular-queries
Fix for combining raw and regular filters
This commit is contained in:
		| @@ -7,6 +7,7 @@ Development | ||||
| =========== | ||||
| - (Fill this out as you fix issues and develop your features). | ||||
| - Add Mongo 4.0 to Travis | ||||
| - Fixed a bug causing inaccurate query results, while combining ``__raw__`` and regular filters for the same field #2264 | ||||
|  | ||||
| Changes in 0.19.1 | ||||
| ================= | ||||
|   | ||||
| @@ -169,9 +169,9 @@ def query(_doc_cls=None, **kwargs): | ||||
|  | ||||
|         key = ".".join(parts) | ||||
|  | ||||
|         if op is None or key not in mongo_query: | ||||
|         if key not in mongo_query: | ||||
|             mongo_query[key] = value | ||||
|         elif key in mongo_query: | ||||
|         else: | ||||
|             if isinstance(mongo_query[key], dict) and isinstance(value, dict): | ||||
|                 mongo_query[key].update(value) | ||||
|                 # $max/minDistance needs to come last - convert to SON | ||||
|   | ||||
| @@ -24,6 +24,12 @@ class TestTransform(unittest.TestCase): | ||||
|         } | ||||
|         assert transform.query(friend__age__gte=30) == {"friend.age": {"$gte": 30}} | ||||
|         assert transform.query(name__exists=True) == {"name": {"$exists": True}} | ||||
|         assert transform.query(name=["Mark"], __raw__={"name": {"$in": "Tom"}}) == { | ||||
|             "$and": [{"name": ["Mark"]}, {"name": {"$in": "Tom"}}] | ||||
|         } | ||||
|         assert transform.query(name__in=["Tom"], __raw__={"name": "Mark"}) == { | ||||
|             "$and": [{"name": {"$in": ["Tom"]}}, {"name": "Mark"}] | ||||
|         } | ||||
|  | ||||
|     def test_transform_update(self): | ||||
|         class LisDoc(Document): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user