These are chat archives for Automattic/mongoose

25th
Apr 2018
panigrah
@panigrah
Apr 25 2018 00:52

@amatiasq do a find(), loop through results and update each document as the simple way. See here

Model.find({}, {_id: true, value: true}).forEach(function(q) {
    Model.update(
      { _id: q._id },
      { $set: { value: q.value * 0.75 } }
  );

});

Daouda Fofana
@DaoFof
Apr 25 2018 04:20
@panigrah nice way
Nenad Milivojević
@shone83
Apr 25 2018 15:00
Hi, can someone explain me how to count percentage in route if I have two numbers in variables (one is populated from another collection)?
Konstantin Kostiuk
@SET001
Apr 25 2018 17:46
what may be the reasons for populate not to work like here in my case - https://imgur.com/a/2i0xpxH ?
Kev
@lineus
Apr 25 2018 19:35
your gameObject schema has rel instead of ref
@SET001 ^
Konstantin Kostiuk
@SET001
Apr 25 2018 19:41
@lineus thanx a lot, I wasted 2 hours for a simple typo *(
Kev
@lineus
Apr 25 2018 19:41
no worries, we've all done it :)