My MongoDB document looks like this.
{
_id: '556ebf103a8b4c3d067bb6466df7c0651c53a1ff79fa348edff656586c24ad0c',
Log: [
{
ScriptName: 'UpdateScript',
ScriptLogs: [
{
ID: 'f5bd1fefb2a5c4712ea1d35eb5bd309074984c5932db3723cc29f8d92258a3fa',
StdOut: 'Hello'
}
]
}
]}
I have the MongoDb Query
db.getCollection("ServerEntitys").update(
{_id: '556ebf103a8b4c3d067bb6466df7c0651c53a1ff79fa348edff656586c24ad0c'},
{
$set: {
'Log.$[i].ScriptLogs.$[j].StdOut': { "$concat": ["$Log.$[i].ScriptLogs.$[j].StdOut", "World"]}
}
},
{ arrayFilters: [ { "i.ScriptName": "UpdateScript" } , { "j.ID": 'f5bd1fefb2a5c4712ea1d35eb5bd309074984c5932db3723cc29f8d92258a3fa'} ] }
)
After running the query I get
StdOut: {
$concat: [
'$Log.$[i].ScriptLogs.$[j].StdOut',
'World'
]
},
instead of
StdOut: 'HelloWorld'
Can someone tell me why mongoDB uses $concat as value and not as a $concat instruction