Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindOneAndUpdate does not create history #12

Open
mayerlench opened this issue Oct 2, 2019 · 5 comments
Open

FindOneAndUpdate does not create history #12

mayerlench opened this issue Oct 2, 2019 · 5 comments

Comments

@mayerlench
Copy link

No description provided.

@joshrezende
Copy link

hello,

old issue but today I'm doing this:

<Schema Name>.post('findOneAndUpdate', async function () {
  const docToUpdate = await this.model.findOne(this.getQuery());
  docToUpdate.__history = {
    event: 'updated',
  };
  await docToUpdate.save();
});

I'll try to add this into the plugin

@saviocamacam
Copy link

Essa solução suporta o uso de transações do Mongo?

@kushalarora92
Copy link

any update here? can someone confirm if @joshrezende's suggestion works?

@joshrezende
Copy link

@kushalarora92 it works but isn't pretty i'm using in production

@joshrezende
Copy link

@saviocamacam vai depender da transacao que voce fizer, se tiver um hook para ela vai funcionar sim, mas teria que testar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants