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

Add support for custom field names and custom schema #109

Conversation

emiljanitzek
Copy link

@emiljanitzek emiljanitzek commented Sep 30, 2021

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

  • custom names for both deletedBy and deletedAt
  • ability to supply custom schema type definition for deletedBy and deletedAt (could make the current deletedByType obsolete, can be replaced by { deletedBy: { type: String } })?

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

@emiljanitzek emiljanitzek force-pushed the feature/custom-name-schema-option branch from 7bc54e4 to d6d4a6e Compare September 30, 2021 15:20
@athahersirnaik
Copy link

@dsanel Can you please review and merge this PR.

@emiljanitzek
Copy link
Author

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.

@emiljanitzek emiljanitzek deleted the feature/custom-name-schema-option branch April 10, 2024 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants