mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 06:12:19 +01:00
$or queries replaced with $in which is much easier to read in code and prepare
This commit is contained in:
parent
4dee025cfe
commit
0af320f9f7
3 changed files with 3 additions and 9 deletions
|
|
@ -277,10 +277,7 @@ class DeleteAsset(BaseAction):
|
||||||
'message': 'No entities to delete in avalon'
|
'message': 'No entities to delete in avalon'
|
||||||
}
|
}
|
||||||
|
|
||||||
or_subquery = []
|
delete_query = {'_id': {'$in': all_ids}}
|
||||||
for id in all_ids:
|
|
||||||
or_subquery.append({'_id': id})
|
|
||||||
delete_query = {'$or': or_subquery}
|
|
||||||
self.db.delete_many(delete_query)
|
self.db.delete_many(delete_query)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -97,10 +97,7 @@ class AssetsRemover(BaseAction):
|
||||||
'message': 'None of assets'
|
'message': 'None of assets'
|
||||||
}
|
}
|
||||||
|
|
||||||
or_subquery = []
|
delete_query = {'_id': {'$in': all_ids}}
|
||||||
for id in all_ids:
|
|
||||||
or_subquery.append({'_id': id})
|
|
||||||
delete_query = {'$or': or_subquery}
|
|
||||||
self.db.delete_many(delete_query)
|
self.db.delete_many(delete_query)
|
||||||
|
|
||||||
self.db.uninstall()
|
self.db.uninstall()
|
||||||
|
|
|
||||||
|
|
@ -562,7 +562,7 @@ def get_subsets(asset_name,
|
||||||
find_dict = {"type": "representation",
|
find_dict = {"type": "representation",
|
||||||
"parent": version_sel["_id"]}
|
"parent": version_sel["_id"]}
|
||||||
|
|
||||||
filter_repr = {"$or": [{"name": repr} for repr in representations]}
|
filter_repr = {"name": {"$in": representations}}
|
||||||
|
|
||||||
find_dict.update(filter_repr)
|
find_dict.update(filter_repr)
|
||||||
repres_out = [i for i in io.find(find_dict)]
|
repres_out = [i for i in io.find(find_dict)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue