Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongodb replace string regex

db.collection.updateMany(
  { name: { $regex: stringToReplace } },
  [{
    $set: { name: {
      $replaceAll: { input: "$name", find: stringToReplace, replacement: "" }
    }}
  }]
)
 
PREVIOUS NEXT
Tagged: #mongodb #replace #string #regex
ADD COMMENT
Topic
Name
7+4 =