I wanted to search and replace one image url. On a single document based collection this following code worked for me.
db.mycollection.updateMany(
{ thumbnail_url: { $regex: /no-img-xx.png/ } },
[{
$set: { thumbnail_url: {
$replaceOne: { input: "$URL", find: "no-img-xx.png", replacement: "no-img.png" }
}}
}]
)
However i have another collection in which the documents are inside the array
I wanted to replace this string staticflyo to helloworld
items.url
Any help please