In cases where MongoDB (7.0.15-9) is under heavy load, as indicated by the execution time breakdown on observability showing that it has reached up to 1 minute, is there a possibility that an aggregation query may return an empty result set, even if documents exist, rather than throwing an error or exception?
Following is the aggregation query -
result = list( self._collection.aggregate( [ {“$match”: {“schemaId”: {“$in”: schema_ids}}}, {“$sort”: {“createdOn”: -1}}, {“$limit”: 1}, {“$project”: {“_id”: 1}}, ] ) )