我们正在尝试将字符串数组“连接”到聚合中的单个字符串。
给出的是以下数据集:
集合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']
}
期望的结果:
{
id: 1234,
field: 'test',
collection2: 'Max, Andy'
}
是否可以以某种方式将“collection2”连接到单个字符串?我们尝试过$concat
但它只接受字符串。