JeffLo
JeffLo

Reputation: 27

Mongo UpdateMany command in javascript not working

diseaseModel.updateMany({matched: current_matched, "$text":{"$search" : `\"${desc}\"`}}, {$inc: {matched: 1}})

I'm trying to find and update my documents that have the field "matched" that matches a variable, and text in the document that matches another variable but this doesn't work, what is the problem with this command?

Upvotes: 0

Views: 85

Answers (1)

R2D2
R2D2

Reputation: 10727

Following way is working:

diseaseModel.updateMany({ matched: current_matched , "$text":{"$search" : `${desc}`  }}, {$inc: {matched: 1}})

Upvotes: 1

Related Questions