i know might easy, me reduce function count using length of documents.
i have large dataset , want count number of records number of key value pairs 44 , below it.
example. set of collection
obj1 - {44 fields} type object obj2 - {44 fields} type object obj3 - {44 fields} type object obj4 - {44 fields} type object obj5 - {2 fields} type object obj6 - {1 fields} type object obj7 - {44 fields} type object
i want count 5 44 , 2 of < 44.
try this:
> var equals_to_44 = 0; > var non_equal_to_44 = 0; > db.your_collection.find().foreach(function(x) { count=0; for(field in x) { count++; } if (count==44){equals_to_44++;} else {non_equal_to_44++;} })