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
[template-engine-preview-5] Transforms returning objects without _id #1617
Comments
Thanks @mystor. Agreed that we should supply a better error in case a transform function returns documents with no I'd just like to ask: Requiring an |
I chatted with @sixolet and @glasser about this and we're probably going to make the following changes to transform:
This will resolve the problem without requiring users to specify |
I think that this is a good option. If the The only situation which I can think of for wanting to have something without an {
"_id": "asdfgh",
"text": "abc123"
} Where the transform would just return the string "abc123", to remove the requirement for a property access (which could fail if Collection.findOne() returned undefined). I feel that preventing that use case is probably good, as it encourages better practices and ensures that people don't build their projects in an unmaintainable way. A transform without an |
Fixed on fe661ee |
If you return an object without an _id property from a collection transform, it produces a very cryptic error if a cursor for the collection is later used in a template.
I understand that having an _id property is useful for objects returned by a transform, but it would be nice to have a check to ensure that an _id field is returned if future code will rely on its presence.
This code runs without issue on the current release of meteor (0.6.6.3).
The text was updated successfully, but these errors were encountered: