0

This Meteor client code tries to create selected fields an sets their values to true, the miniMongo is not being updated.
There are few items in the indexes array. How can it be fixed? Thanks

let res = myColMini.update({
  index: {
    $in: [indexes]
  }
}, {
  $set: {
    selected: true
  }
}, {
  multi: true
});
console.log(res); //<--- 0
Fred J.
  • 5,759
  • 10
  • 57
  • 106
  • I believe the multi update is not supported in Meteor miniMongo. (I could be wrong but I have had a similar issue with multi insert) the way to get around this is to loop through each document and update one at a time without multi. – MrE Jul 15 '16 at 17:41

1 Answers1

0

Correct, multi is not supported on the client. Either run this update on the server or do:

myColMini.find({ index: { $in: [indexes] } }).forEach(function(m),{
  myColMini.update(m._id, $set: { selected: true } });
});
Michel Floyd
  • 18,793
  • 4
  • 24
  • 39