I'm new to MongoDB. I've imported a json file into my MongoDB. The structure looks like the following:
What I'm trying to do is get all the data for player 0, player 1,.. etc but I don't know how my db.collection.find should look.
I'm new to MongoDB. I've imported a json file into my MongoDB. The structure looks like the following:
What I'm trying to do is get all the data for player 0, player 1,.. etc but I don't know how my db.collection.find should look.
 
    
     
    
    Use db.collection.aggregate([{$unwind:"$match.players"}]). You cal also choose which field to project and which field to not. You can add that in the aggregation pipeline.
     db.collection.aggregate([{$unwind:"$match.players"},
                               {$project:{_id:1, player:'$match.players'}}
                             ]);
