[SOLVED] findAndModify error since 2.6

Hello,
I used to use a wrapAsync around findAndModify but this is not working since meteor v2.6
Do you have an example on how to do this ?

this is my code

const rawCounters = Counters.rawCollection();
  const findAndModifySync = Meteor.wrapAsync(rawCounters.findAndModify, rawCounters);
  const ret = findAndModifySync({
    query: { _id: lowercase },
    update: { $inc: { seq: 1 } },
    new: true,
  });

Thanks a lot

Is it deprecated ? I found this instead : findOneAndUpdate ?

I think I solved my problem with the use of findOneAndUpdate

const rawCounters = Counters.rawCollection();
    const findOneAndUpdateSync = Meteor.wrapAsync(rawCounters.findOneAndUpdate, rawCounters);
    const ret = findOneAndUpdateSync({ _id: lowercase }, { $inc: { seq: 1 } }, {returnDocument: 'after'});
1 Like