File tree 1 file changed +6
-6
lines changed
src/spaceone/core/model/mongo_model
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -610,12 +610,7 @@ def _stat_with_unwind(
610
610
raise ERROR_DB_QUERY (reason = "unwind option should have path key." )
611
611
612
612
unwind_path = unwind ["path" ]
613
- unwind_filter = unwind .get ("filter" )
614
-
615
- aggregate = [{"unwind" : {"path" : unwind_path }}]
616
-
617
- if unwind_filter :
618
- aggregate .append ({"match" : {"filter" : unwind_filter }})
613
+ aggregate = [{"unwind" : unwind }]
619
614
620
615
# Add project stage
621
616
project_fields = []
@@ -1088,6 +1083,11 @@ def _make_aggregate_rules(cls, aggregate):
1088
1083
if "unwind" in stage :
1089
1084
rule = cls ._make_unwind_rule (stage ["unwind" ])
1090
1085
_aggregate_rules .append (rule )
1086
+
1087
+ if unwind_filter := stage ["unwind" ].get ("filter" ):
1088
+ rule = cls ._make_match_rule ({"filter" : unwind_filter })
1089
+ _aggregate_rules .append (rule )
1090
+
1091
1091
elif "group" in stage :
1092
1092
rule , group_keys = cls ._make_group_rule (stage ["group" ], _group_keys )
1093
1093
_aggregate_rules .append (rule )
You can’t perform that action at this time.
0 commit comments