I need help in mongodb to update record as explained below.
original text in “name” field of a document is “This is sample text (with some text into bracket)” and
I need to update it to “This is sample text”.
I want to remove everything inside bracket including bracket.
I am using following query in mongodb studio 3T intellisense
db.tracks.update(
{"_id" : ObjectId("5d91dabf0413c90008b39c3e")},
{$set : { "name" : "This is sample text" }},
{multi : true}
)
I want to use substr to get text upto opening bracket position, but question is - how to find variable position of opening bracket “(” for substr function and how to use substr.
Regards,