dsanel / mongoose-delete

Mongoose Soft Delete Plugin
MIT License
346 stars 101 forks source link

Add support for custom field names and custom schema #109

Closed emiljanitzek closed 2 years ago

emiljanitzek commented 3 years ago

We are migrating to mongoose but our deletedBy/At fields have different names and for legacy reasons, we can not change this right now. We also need the ability to use a custom getter to transform our value.

This PR will added support for

I was inspired by how mongoose handles the timestamp schema option. Let me know if you prefer another way. Will resolve issue #92

athahersirnaik commented 3 years ago

@dsanel Can you please review and merge this PR.

emiljanitzek commented 2 years ago

While waiting for this PR to be approved we kept running into trouble with typescript and the type definitions. And the way methods are dynamically created and method signature was overridden made it really hard to work with this in typescript.

So we created a fork which we now published that is completely rewritten in typescript. The main concept is the same, but some interfaces/methods have changed and we removed some features and it does require mongoose 6 to work.

Feel free to check it out at https://github.com/emiljanitzek/mongoose-delete-ts.