我们正在try 将字符串数组"连接"到聚合中的单个字符串.
给出了以下数据集:
Collection 1:
{
id: 1234,
field: 'test'
}
第2集:
{
id: 1111,
collection1_id: 1234,
name: 'Max'
},
{
id: 1112,
collection1_id: 1234,
name: 'Andy'
}
当前结果(在查找等之后):
{
id: 1234,
field: 'test',
collection2: ['Max', 'Andy']
}
The desired result:
{
id: 1234,
field: 'test',
collection2: 'Max, Andy'
}
是否有可能将"collection2"连接到单个字符串?我们try 了$concat
,但它只接受字符串.