I have the following document:
{
"_id":"000001"
"publicId":"0001"
"name":John"
}
Now i would like to concat "M" before each publicId. I did query like this:
db.names.aggregate(
[
{ $project: { publicId: { $concat: [ "M", "$publicId" ] } }},
{$out:"names"}
]
)
The problem I have is that I lose the name property:
{
"_id":"000001"
"publicId":"M0001"
}
How can I prevent that?