mongoose-history-plugin
mongoose-history-plugin copied to clipboard
FindOneAndUpdate does not create history
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
Essa solução suporta o uso de transações do Mongo?
any update here? can someone confirm if @joshrezende's suggestion works?
@kushalarora92 it works but isn't pretty i'm using in production
@saviocamacam vai depender da transacao que voce fizer, se tiver um hook para ela vai funcionar sim, mas teria que testar