Merged in feature/mongo_or_query (pull request #356)

feature/mongo_or_query

Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
Jakub Trllo 2019-11-19 22:26:41 +00:00 committed by Milan Kolar
commit 4201ba173d
3 changed files with 3 additions and 9 deletions

View file

@ -277,10 +277,7 @@ class DeleteAsset(BaseAction):
'message': 'No entities to delete in avalon'
}
or_subquery = []
for id in all_ids:
or_subquery.append({'_id': id})
delete_query = {'$or': or_subquery}
delete_query = {'_id': {'$in': all_ids}}
self.db.delete_many(delete_query)
return {

View file

@ -97,10 +97,7 @@ class AssetsRemover(BaseAction):
'message': 'None of assets'
}
or_subquery = []
for id in all_ids:
or_subquery.append({'_id': id})
delete_query = {'$or': or_subquery}
delete_query = {'_id': {'$in': all_ids}}
self.db.delete_many(delete_query)
self.db.uninstall()

View file

@ -562,7 +562,7 @@ def get_subsets(asset_name,
find_dict = {"type": "representation",
"parent": version_sel["_id"]}
filter_repr = {"$or": [{"name": repr} for repr in representations]}
filter_repr = {"name": {"$in": representations}}
find_dict.update(filter_repr)
repres_out = [i for i in io.find(find_dict)]