I have the following mongo db collection
{
 "_id" : 1,
 "name" : "Sam",
 "telephone" : [1234,4567,8678],
 "age" : 34
},
{
 "_id" : 2,
 "name" : "Joe",
 "telephone" : [4456,4434],
 "age" : 42
}
I want to fetch the name and the count of telephone. what should be the query? My output should be as below.
{
  "name" : "Sam",
  "telephoneCount" : 3
},
{
  "name" : "Joe",
  "telephoneCount" : 2
} 
 
     
    