MongoDB
 sql >> Database >  >> NoSQL >> MongoDB

MongoDB ottiene SubDocument

Puoi farlo con Aggregation Framework. La query sarà qualcosa del tipo:

db.customer.aggregate([
    {$unwind : "$channels"},
    {$match : {"channels.id" : "10000-1"}},
    {$project : {_id : 0, 
                 id : "$channels.id", 
                 name : "$channels.name", 
                 enabled : "$channels.enabled"}}
])