mongoose-sequence icon indicating copy to clipboard operation
mongoose-sequence copied to clipboard

issue #45 - implement setNext changes to allow its usage within pre-s…

Open rernens opened this issue 5 years ago • 6 comments

Allow use a setNext within the pre-save hook in making save optional through new args.

Preserve current behaviour in making save the default behaviour if no arg set

rernens avatar Feb 15 '19 13:02 rernens

Coverage Status

Coverage decreased (-1.6%) to 98.425% when pulling c8474d5f1600093d4729cd8ce0cb1d8055d4701c on rernens:setNext-within-pre-save-hook into 94b4daf224ca175954df96ea1f4c6c796dcb4e95 on ramiel:develop.

coveralls avatar Feb 15 '19 13:02 coveralls

Coverage Status

Coverage decreased (-1.6%) to 98.425% when pulling c8474d5f1600093d4729cd8ce0cb1d8055d4701c on rernens:setNext-within-pre-save-hook into 94b4daf224ca175954df96ea1f4c6c796dcb4e95 on ramiel:develop.

coveralls avatar Feb 15 '19 13:02 coveralls

Hello @rernens , sorry for coming back so late to you but I had no time at all to look at this. I ned to fin the time to look at it carefully. Maybe you could add some test case? Also, if you need it in your projects you can include it in your dependencies like this in your package.json

"mongoose-sequence": "rernens/mongoose-sequence#setNext-within-pre-save-hook"

I'm sure you already know. Sorry, this will take some other time for me. Busy days! Thank you for it in any case!!

ramiel avatar Mar 01 '19 19:03 ramiel

So, your intent is to make this kind of calls?

this.setNext('employees_counter', false, (err) => {
  ...
});

and so the save won't be called? I understand. I also remember that a previous version of this plugin did not save and you had to call save explicitely. I think this PR is a good idea. It needs some test and an update to the documentation. I hope you can do it or I must take over whenever I'll have time.

ramiel avatar Mar 01 '19 19:03 ramiel

@ramiel

Hi Fabrizio

You are right, this PR allows to keep the current behavior as well as integrating the required behavior to use setNext within a pre-save hook.

I am using it in a web app that went live yesterday.

While as busy as you are, I will try to find some time over the next 72 hours, to change the doc and write some test.

rernens avatar Mar 04 '19 08:03 rernens

Hi guys, any update on this PR? We need this please...

cristizuum avatar Jun 24 '20 20:06 cristizuum