Skip to content

Commit b24ca81

Browse files
committed
Attempt to fix nested model retrival
1 parent 0bd37f5 commit b24ca81

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

opensensor/collection_apis.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ def create_nested_pipeline(model: Type[BaseModel], prefix="", pipeline=None):
203203
match_conditions = {}
204204
if pipeline is None:
205205
pipeline = {
206-
"_id": False,
207206
"timestamp": "$timestamp",
208207
}
209208

@@ -397,11 +396,13 @@ def get_uniform_sample_pipeline(
397396
}
398397
}
399398
}
399+
# Add a stage to explicitly exclude _id field from the output
400400
},
401401
{"$group": {"_id": "$group", "doc": {"$first": "$$ROOT"}}},
402402
{"$replaceRoot": {"newRoot": "$doc"}},
403403
{"$project": project_pipeline},
404404
{"$sort": {"timestamp": 1}},
405+
{"$project": {"_id": 0}},
405406
]
406407

407408
logger.info(f"Pipeline for {response_model.__name__}: {pipeline}")

0 commit comments

Comments
 (0)