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

Why not separate mongoose plugins into a diff repository? #24

Closed
iagowp opened this issue Aug 28, 2020 · 1 comment
Closed

Why not separate mongoose plugins into a diff repository? #24

iagowp opened this issue Aug 28, 2020 · 1 comment

Comments

@iagowp
Copy link

iagowp commented Aug 28, 2020

Also, loved the idea for private fields, but it doesn't work with nested fields. I've made a change on the project I've started from this boilerplate, something like

if (path.includes('.')) {
  const [a, b] = path.split('.');
  delete ret[a][b];
} else {
  delete ret[path];
}

it obviously only work for 1 level of nesting, but changing to allow multiple would be fairly easy. Do you think this is something you'd like to see added to the plugin in this repo, or perhaps in a separated package?

@hagopj13
Copy link
Owner

hagopj13 commented Sep 9, 2020

@iagowp thanks for the feedback. I am already thinking about extracting this plugin into a different repo. When I do so, I will also consider private nested fields.
Another thing you could do (for now), is create a model for the sub document and attach the plugin to it as well. Then private fields of the sub document would also be handled correctly.

@hagopj13 hagopj13 closed this as completed Sep 9, 2020
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

No branches or pull requests

2 participants