mongo $and list should not contain list elements in order to avoid this error:
$and/$or elements must be objects
This commit is contained in:
		| @@ -160,7 +160,7 @@ def query(_doc_cls=None, _field_operation=False, **query): | |||||||
|         if isinstance(v, list): |         if isinstance(v, list): | ||||||
|             value = [{k: val} for val in v] |             value = [{k: val} for val in v] | ||||||
|             if '$and' in mongo_query.keys(): |             if '$and' in mongo_query.keys(): | ||||||
|                 mongo_query['$and'].append(value) |                 mongo_query['$and'].extend(value) | ||||||
|             else: |             else: | ||||||
|                 mongo_query['$and'] = value |                 mongo_query['$and'] = value | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user