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

trim: true is a bad default #505

Closed
rijk opened this issue Nov 20, 2015 · 2 comments
Closed

trim: true is a bad default #505

rijk opened this issue Nov 20, 2015 · 2 comments

Comments

@rijk
Copy link

rijk commented Nov 20, 2015

Hi,

I just had to spend an hour tracking down why leading returns in a copy text were being removed. Luckily I noticed I introduced a Schema for the collection in the update where it broke, otherwise it could have taken me a lot longer.

I would argue that modifying the data like this when the developer has not asked for it, is a bad practice. What if more packages start doing these kinds of 'smart things'? You will be constantly hunting through all of your packages trying to figure out why unexpected stuff is happening.

Furthermore: it seems you cannot even disable this trimming for objects that are blackbox:true. (please correct me if I'm wrong!) This means for my use case (the content property is a blackbox because it's used by multiple modules), the only solution is to disable the schema for this collection.

@aldeed
Copy link
Collaborator

aldeed commented Nov 23, 2015

It can be disabled when you call clean, or when you call insert or update if using collection2, which calls clean for you (even for blackbox).

At the simple-schema level, I think trimming by default is probably correct because it is what most people will want. But I agree that collection2 doing it for you automatically can be confusing. So I've opened an issue over in the C2 repo: Meteor-Community-Packages/meteor-collection2#283

@aldeed aldeed closed this as completed Nov 23, 2015
@rijk
Copy link
Author

rijk commented Nov 24, 2015

Thank you!

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