-
Type: New Feature
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.5.1
-
Component/s: Querying
-
Labels:None
-
Query
Obtaining counts for large attributes can be a pain. Approaches are to:
1) Return the entire array and examine length
2) group/reduce and output the length
3) map/reduce to get length
4) ensure documents maintain length attribute across document lifespan
I think being able to request embedded array length directly would be helpful.
Perhaps something like:
db.collection.find({}, {some_array: {$count: true}})