-
Notifications
You must be signed in to change notification settings - Fork 258
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
Update mongodb native to 2.0. Issue #233. #260
Conversation
nice! thanks @andypham we'll look this over |
Thanks Travis. On Saturday, April 18, 2015, Travis Webb [email protected] wrote:
|
+1 |
I have a ticket open for the mongo 3.0 support in travis here... Hopefully it's fixed soon. travis-ci/travis-ci#3694 |
Good news! After upgrading travis to run mongo 2.6.5 all tests passed for node 0.10.x. Awaiting for node 0.11.x tests. |
|
Why nodejs 0.11.x? Must be 0.12.x for production |
@andypham true, not sure what to make out of that, let's see if upgrading to 0.12 gets rid of it |
Green light a GO! All test passed with node 0.10.x and 0.12.x running on mongo 2.6.5. |
@andypham will this change make sails-mongo incompatible with older mongo versions? |
@tjwebb This change updated the API breaking changes for mongo native driver 2.0. For example, some modifiers no longer take regex for mongo 2.6.5 and 3.0. Before this update the tests were already failing for these regex modifiers. |
This PR will put sails-mongo in much better shape! 👍 @devinivy, any thoughts about this? For reference, this PR fixes #256 and #233. |
"waterline-errors": "~0.10.0", | ||
"waterline-cursor": "~0.0.5" | ||
"mongodb": "^2.0.27", | ||
"waterline-adapter-tests": "^0.10.10", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waterline-adapter-tests should be on devDependencies.
Aside from @dmarcelino's comment, this looks really great. Thanks, @andypham !! |
@devinivy Thanks for looking at this. |
Without the regex query for something like $ne is it still case in-sensitve? I don't think we have tests for that anywhere. |
@particlebanana, https://github.com/balderdashy/waterline-adapter-tests/blob/master/interfaces/queryable/caseInsensitive.test.js addresses case-insensitive queries. |
@particlebanana Using case in-sensitive by default will make our query slower. Here is how make regex case in-sensitive query. Edit: The regex doc above won't work for comparison operators with case in-sensitive. There a a few possible way of doing this:
|
// Omit adding regex value to these modifiers | ||
var omitRegExModifiers = ['$ne', 'greaterThan', '>', 'gt', 'greaterThanOrEqual', | ||
'>=', 'gte', '$gt', '$gte' | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should '<', 'lessThan', '<=', 'lessThanOrEqual' also be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmarcelino I didn't add the lessthan operator because waterline adapter test didn't complain. However, with my curiosity I just ran a few query for the lessthan operator with regex and it barf with error same as the above operators "BadValue Can't have RegEx as arg to predicate over field". I will add the lessthan to the list. Thanks.
Regarding @particlebanana's comment above (#260 (comment)) I've added case insensitivity tests for By default the waterline API operates in case insensitivity mode (not saying it's good) so we need to abide by that. In order to get the best of both worlds, we can optionally add a Last, @andypham can you please remove |
@andypham oh I know it's horrendously slow and doesn't allow you to use indexes but it's how the Waterline api works currently (started with MySql as first adapter). We can absolutely change this in a new major version of WL but we can't push breaking changes like that at the adapter level. To get around this I added a feature flag on the postgres adapter that you can turn on at the application level to allow these like @dmarcelino mentioned. We could do something similar here. |
@dmarcelino Let me pull in your test and try it out. Thanks for adding them. |
Good stuff, no worries. |
@particlebanana The comparison operators can't take regex value as far as I know for mongo 2.6.5 and 3.0.2. So if we enable case-insensitive search mongo datastore itself would complain. I see that before this change the $ne operator had a similar issue with regex and implemented a similar fix. IMO, we need decide with the release version which mongo we should support. Running travis integration test and maintaining backward compatibility for these comparison operators might be quite a challenge. |
Do you guys know which mongo version work for regex comparison operators? |
Create beta version? |
@particlebanana, are regex comparisons widely supported in waterline or is it a sails-mongo specific feature? And have they been working in a case insensitive manner before? If it's a sails-mongo specific feature and they haven't worked before in case insensitive manner I think we can safely proceed with this. |
@particlebanana How should we move forward with this pull request? It looks like this text search case-insensitive issue has been tackled once before #235? |
@dmarcelino the regex comparisons from the waterline api aren't documented I don't believe, if they still exists. The following query should work the same between mongo and mysql though: User.find({name: { '!': 'clark' }}).exec(/**/); That should only return the one record from the following list: [
{ name: 'clark' },
{ name: 'Clark' },
{ name: 'bob' }
] That's how it works in other adapters unless I'm way off and it's been broken for awhile. If that's not possible to do any longer then we need to figure out the next steps. As for |
@particlebanana, balderdashy/waterline-adapter-tests#53 adds the tests for @andypham, did your changes pass these tests when you pulled my waterline-adapter-tests? @particlebanana, if it passes the tests can you merge this? |
@dmarcelino Tests cases for case-insensitive failed. |
I see... honestly the tests are already broken (before your change), so I think we should move forward as your change improves things and doesn't break anything new. After merging your changes we should look into PR #235, as you suggested, to try and improve the case insensitive @particlebanana, what do you think? |
@dmarcelino Agreed. Lets move forward with this and figure out #235. |
Update mongodb native to 2.0. Issue #233.
Happy days, sails-mongo build is now green: Thanks @particlebanana! Can you please also merge #255: Add badges and return non-zero if build breaks tests? It will help us detect errors earlier, namely during PRs. And thanks @andypham 😉 |
PR #235 looked like a potential fix for the case insensitive issue but after trying it the tests still fail, hence I've raised #265. |
No description provided.