My schema looks like
name:
value:
p_vars: {
    name1: {},
    name2: {},
}
I want to count how many items are there in p_vars.
Thinking that interpretor is JavaScript, I tried  
db.collection.findOne().p_vars.length
But nothing returns
Answer should be
Considering above, answer should be 2(two items name1 and name2)
 
    