-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Empty show more show less
We currently use
{'$group': {'_id': null, 'n': {'$sum': 1} } }
as an aggregation stage for the countDocuments. The _id can be any constant value, like 1 or 0. Since it can be any constant value, we should change the group stage to:
{'$group': {'_id': 1, 'n': {'$sum': 1} } }
This helps us with test runners and languages that consider null to be an indication that a key is not present.