0

I want to annotate some messages in MongoDB from a social network as spam. If I use in the query _id, it works, but not using regular expression.

this works for one record:

db.group_data.update({_id:"gid_91496835_topic_192"},{$set:{SPAM:true}})

this doesn't work for all, but seems to update one record:

db.group_data.update({"text":/.*yburlan.ru.*/},{$set:{SPAM:true}})

WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })

How can I update/set to all records found by regexp?

0

1 Answer 1

3

You should add the multi option :

db.group_data.update({"text":/.*yburlan.ru.*/}, {$set:{SPAM:true}}, {multi: true})
Sign up to request clarification or add additional context in comments.

1 Comment

YES! cool, many many thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.