Let\'s say I have the following documents in collection:
{
\"family\": \"Smith\",
\"children\": [
{
\"child_name\": \"John\"
You can just do:
db.collection.distinct("children.child_name");
In your case it returns:
[ "John", "Anna", "Kevin" ]
with the help aggregation framework:
db.collection.aggregate([{$unwind:'$children'}, {$group:{_id:'$children.child_name'}}])
or more interest ;) with frequency of name:
db.collection.aggregate([{$unwind:'$children'}, {$group:{_id:'$children.child_name', freq:{$sum:1}}}])