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

Possibly clone object before cleaning #182

Open
aldeed opened this issue Feb 19, 2015 · 1 comment
Open

Possibly clone object before cleaning #182

aldeed opened this issue Feb 19, 2015 · 1 comment

Comments

@aldeed
Copy link
Collaborator

aldeed commented Feb 19, 2015

Cleaning in the deny functions needs to mutate the object because that's the only way to alter the doc before it is inserted, but in the other two cases, we can clone to ensure no surprises for the user. Most likely a deep clone is necessary.

Add tests for this, and then fix such that they pass.

@aldeed
Copy link
Collaborator Author

aldeed commented Feb 19, 2015

See also Meteor-Community-Packages/meteor-simple-schema#250

It still seems best and easiest to continue mutating in the simple-schema clean method, but do a deep clone (EJSON.clone() maybe) before that in the collection2 code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants