北京順義黑馬前端就業(yè)133期
db.inventory2.aggregate( [ { $unwind: "$sizes" } ] )
db.inventory2.aggregate( [ { $unwind: { path: "$sizes" } } ] )
結(jié)果
{ "_id" : 1, "item" : "ABC", "price" : NumberDecimal("80"), "sizes" : "S" }{ "_id" : 1, "item" : "ABC", "price" : NumberDecimal("80"), "sizes" : "M" }{ "_id" : 1, "item" : "ABC", "price" : NumberDecimal("80"), "sizes" : "L" }{ "_id" : 3, "item" : "IJK", "price" : NumberDecimal("160"), "sizes" : "M" }
標簽: