2017-02-06 102 views

回答

1
db.collection.aggregate([ 
    { $unwind: '$molecules' }, 
    { $group: { 
    _id: '$scene', 
    molecules: { $push: { $size: '$molecules.data' } }, 
    } }, 
]) 

{ _id: 7674, molecules: [ 2, 1 ] }