Mongodb如何替换mysql中的GROUP_CONCAT

时间:2017-12-19 07:22:00

标签: mysql mongodb

这是mongo shell



db.product.aggregate([
   
    {
        $lookup:{
            from: "orders",
             let: { id: "$_id" ,multiId:"$multi_id"},
            as: "orders1",
             pipeline:[{ $match:{ $expr:{ $and:[
                          {$in:[{$substr:["$pid",0,-1]},{ $split:["$$multiId",","] }  ]}
                        ]
                     }
                     }
                }
            ]
        }
    },
  
    {
        $project:{
            price:1,
            orders:1,
            multi_id:1,
            orders1:1
        }
    },
])




结果是:

This is the result

但我希望结果是:(如何将数组" order"转换为String)

This is a result what I want

0 个答案:

没有答案