From 5dd4e8861a81e60d1d1dad67eb2aff5717bd85a2 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 7 Nov 2023 16:34:51 -0800 Subject: [PATCH] Fix aggregation pipeline kwargs --- src/maggma/api/resource/read_resource.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/maggma/api/resource/read_resource.py b/src/maggma/api/resource/read_resource.py index 9d2ca7e38..20824774b 100644 --- a/src/maggma/api/resource/read_resource.py +++ b/src/maggma/api/resource/read_resource.py @@ -237,10 +237,15 @@ def search(**queries: Dict[str, STORE_PARAMS]) -> Union[Dict, Response]: else: pipeline = generate_query_pipeline(query, self.store) + agg_kwargs = {} + + if query.get("agg_hint"): + agg_kwargs["hint"] = query["agg_hint"] + data = list( self.store._collection.aggregate( pipeline, - hint = query.get("agg_hint"), + **agg_kwargs ) )