These are chat archives for Automattic/mongoose

Apr 2016
Gjorge Karakabakov
Apr 22 2016 05:16
Hello guys - how can i make sure that all updates to a specific collection item have finished? I'm making an API and when i spam update (returns updated data), then send a GET with findOne it sometimes returns old data.
Code i use for update
        .findByIdAndUpdate({ _id: id }, { $set: params }, { 'new': true })
        .exec(function (error, user) {
          return res.json({ user: user });
code i use for get
    .findById(id, '-password')
    .exec(function (error, user) {