-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Javascript reserved words / transformed collections bug #8329
Comments
Thanks for the excellent reproduction @dburles - I'm seeing the same thing. |
Interesting - the problem happens here: meteor/packages/mongo/collection.js Line 381 in 3801349
When I haven't digested that entire thread yet (not enough coffee!), but I'll take a closer look shortly. Replacing the |
Ha - I just noticed this in the underscore
🙂 |
Just some history on this Underscore https://github.com/meteor/meteor/blob/devel/packages/underscore/underscore.js#L88 My understanding has been that Meteor "fixed" this issue in Underscore by forking and patching its own private copy. I'd be very interested to know how this bug evaded that "fix". |
Yeah, perhaps rather Edit: I just tried this and the tests pass as expected. I'm just not sure on whether this would have any side effects. |
Hi guys - sorry for the delay on this. I've looked more closely at why this is failing. The problem happens here: var looksLikeArray = function (obj) {
return (obj.length === +obj.length
// _.isArguments not yet necessarily defined here
&& (_isArguments(obj) || obj.constructor !== Object));
}; This returns true for the for (var i = 0, length = obj.length; i < length; i++) {
if (iterator.call(context, obj[i], i, obj) === breaker) return;
} This is clearly not what should be happening, since the incoming object is being treated like an array. So we can either fix this check in Meteor's custom |
PR #8380 was merged, so the fix will be coming soon. Thanks for reporting this! |
This should be fixed in Meteor 1.4.3.2. You can try the latest 1.4.3.2 beta and help confirm by running:
Please report back if you encounter any problems, and thanks for taking reporting this! |
This issue was originally brought to my attention via the
dburles:collection-helpers
package by @RaniereSouza and @vsivsi.In spending some time investigating it further it appears that using a transformed document containing a numeric field named
length
as a query selector seemingly mangles the resulting query.Simple reproduction (transform example from the Meteor documentation):
In this example the test fails as the resulting query returns 3 documents instead of 1.
Full reproduction app
Note that this also affects the
remove
query.The text was updated successfully, but these errors were encountered: