在 $facet 中使用外部组 _id 值,在其中为 MongoDB 使用不同的组

我想使用 nametitle 的组与其他 _id 一起在 facet 内使用以获取该组的计数。

data = db.objects().aggregate(
   {"$group": {"_id": {"name": "$name","title": "$title"},"details": {"$push": {"name": "$name","title": "$title"}}}},{"$facet": {
      "product_details": [
         {"$group": {"_id": {"details": "$details","product": "$product"},"pdcount": {"$sum": 1}}},],"address_details": [
         {"$group": {"_id": {"details": "$details","address": "$address"},"add_count": {"$sum": 1}}},}},{"$skip": skipdata},{"$limit": pagelimit})
liangpengju20080809 回答:在 $facet 中使用外部组 _id 值,在其中为 MongoDB 使用不同的组

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/8336.html

大家都在问