0

I have a mongo field like this:

answers = [
  {
    "answer" : "Test",
    "votes" : 1
  },
  {
    "answer" : "Blaat",
    "votes" : 0
  },
  {
    "answer" : "Bliep",
    "votes" : 0
  }
]

Now I want to set all "votes" fields to 0, how can I achieve this? I've tried this:

$set: { 'answers.votes': 0 }

It doesn't give an error, but doesn't change the fields.

Any ideas?

Thanks!

RobinKuiper
  • 97
  • 10
  • or this one: [How to Update Multiple Array Elements in mongodb](https://stackoverflow.com/questions/4669178/how-to-update-multiple-array-elements-in-mongodb) – styvane Oct 24 '15 at 06:48
  • The answer to your question is in the duplicate I linked so please read it first and try it first. – styvane Oct 24 '15 at 06:53

0 Answers0