I have a query that finds the items I'm looking for:
db.user.find({email:/xhjvv123/}).pretty()
These are emails that all have that string (xhjvv123
) as the first 8 characters. I want to find all emails with that string and then remove the string.
I think I can use $substr
, but I can only find examples that return data. How to I actually change the string?
EDIT based on comments
ex. I have an email xhjvv123dbw@test.com
. I want to change the email to just dbw@test.com
. This will be true for hundreds of emails; i want to find all the emails with the string xhjvv123
, remove that string, and leave the rest of the email intact.