Series is one document. It has an array of series inside it (in this case it has 'Revenge' and 'Raines'). Each series has a cast array with names. And I need a query to get those names.
Who know how can I get a list of all the names from both cast arrays?
My best approach was this query db.series.find( {}, { _id: 0, cast: 1 } ) where a get a cursor with the two cast json arrays.
{ series:
[
{
name: 'Revenge',
user_rating: 7.9,
duration: 44,
genres: [ ' Drama', ' Mystery', ' Thriller' ],
year_start: '2011',
year_end: '',
cast:
[ { name: 'Madeleine Stowe' },
{ name: 'Emily VanCamp' },
{ name: 'Gabriel Mann' },
{ name: 'Nick Wechsler' },
{ name: 'Henry Czerny' },
{ name: 'Joshua Bowman' },
{ name: 'Christa B. Allen' },
{ name: 'Ashley Madekwe' },
{ name: 'Connor Paolo' },
{ name: 'Barry Sloane' },
{ name: 'Margarita Levieva' } ],
seasons: [ { number: '3' }, { number: '2' }, { number: '1' } ]
},
{
name: 'Raines',
user_rating: 7.4,
duration: 45,
genres: [ ' Crime', ' Drama' ],
year_start: '2007',
year_end: '',
cast:
[ { name: 'Jeff Goldblum' },
{ name: 'Matt Craven' },
{ name: 'Nicole Sullivan' },
{ name: 'Linda Park' },
{ name: 'Dov Davidoff' },
{ name: 'Malik Yoba' },
{ name: 'Madeleine Stowe' } ],
seasons: [ { number: '1' } ]
}
]
}
I need an output like this:
I need this:
{ name: 'Madeleine Stowe' },
{ name: 'Emily VanCamp' },
{ name: 'Gabriel Mann' },
{ name: 'Nick Wechsler' },
{ name: 'Henry Czerny' },
{ name: 'Joshua Bowman' },
{ name: 'Christa B. Allen' },
{ name: 'Ashley Madekwe' },
{ name: 'Connor Paolo' },
{ name: 'Barry Sloane' },
{ name: 'Margarita Levieva' },
{ name: 'Jeff Goldblum' },
{ name: 'Matt Craven' },
{ name: 'Nicole Sullivan' },
{ name: 'Linda Park' },
{ name: 'Dov Davidoff' },
{ name: 'Malik Yoba' },
{ name: 'Madeleine Stowe' }