Simple, self-explanatory code snippets.
db.COLLECTION_NAME.aggregate([
{$addFields: {
"CONCATENATED_STRING": {$reduce: {
"input": "$ARRAY_OF_STRINGS_FIELD_NAME",
"initialValue": "",
"in": {
"$concat": [
"$$value",
"$$this",
", ",
]
}
}}
]);
No comments:
Post a Comment