To find one sample item in the callend mycollection:
db.mycollection.find().limit(1)[0];
To get the number of items in the arry category:
db.mycollection.find().limit(1)[0].category.length;
Or:
var elem = db.mycollection.find().limit(1)[0]; elem.category.length;
Dag
source share