I write this script at Robo 3T for mongodb:
db.Events.aggregate([
{$match : {BusinessCode: /(([1-2]?[0-9])-([0-9]*)-([0-9]*)-([0-9]*)-([0-9]*)-([0-9]*)-([0-9]*))/}},
{$project : {BusinessCode : {$arrayElemAt:[{$split : ["$BusinessCode", "-"]},0]}}},
{$addFields: {"Domain": "$BusinessCode"}},
//{ $out : "Events" }
],{
allowDiskUse: true
})
Now I want instead of addFields , I use update! how could I do that?
as you can see I used out but I do not want to create new collection or do replace my collection, I want update aggregate return
into my collection.
in my scenario Domain if exist, filled with new value.
I have seen some post that it was for 4 years ago like this
Now it is possible?