https://www.mongodb.com/docs/manual/core/aggregation-pipeline-optimization/
https://www.mongodb.com/docs/manual/reference/operator/aggregation/

$$this is map `as` default var ref
db.collection.update({},
[
{
$set: {
"images": {
$map: {
input: "$images",
in: {
$replaceOne: {
input: "$$this",
find: "image.xxxx.com",
replacement: "image.xxxx.cn"
}
}
}
}
}
}
],
{
multi: true
})
db.collection.update({},
[
{
$set: {
"image": {
$replaceOne: {
input: "$image",
find: "resource.intbird.cn",
replacement: "image.intbird.cn"
}
}
}
}
],
{
multi: true
})

$unwind
https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/

$push
https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/

const test = [
{
'$match': {
'id': 1
}
}, {
'$unwind': '$users'
}, {
'$match': {
'users.type': 1
}
}, {
'$group': {
'_id': '$_id',
'users': {
'$push': '$users.type'
}
}
}
];