db.getCollection('product_protocol_new').aggregate([
{$sort:{"end_date":-1}},
{$group:{
_id:"$company_protocol", end_date:{"$first":"$$ROOT"},
}}
])
转载于:https://www.cnblogs.com/zjdeblog/p/9485409.html
db.getCollection('product_protocol_new').aggregate([
{$sort:{"end_date":-1}},
{$group:{
_id:"$company_protocol", end_date:{"$first":"$$ROOT"},
}}
])
转载于:https://www.cnblogs.com/zjdeblog/p/9485409.html