-
Notifications
You must be signed in to change notification settings - Fork 236
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
Add case insensitive indexes support #417
Conversation
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
@slnode test please |
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.
@angfal Thank you for your contribution! Could you also update the README to let users know how to leverage this feature? You can use code snippets from the test(s) you wrote as well.
test/mongodb.test.js
Outdated
@@ -2016,6 +2041,22 @@ describe('mongodb connector', function() { | |||
}); | |||
}); | |||
|
|||
it('should allow to find using case insensitive index', function(done) { | |||
Category.create({ title: 'My Category' }, function(err, category1) { | |||
should.not.exists(err); |
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.
typo should.not.exists(err)
-> should.not.exist(err)
test/mongodb.test.js
Outdated
Category.create({ title: 'My Category' }, function(err, category1) { | ||
should.not.exists(err); | ||
Category.create({ title: 'MY CATEGORY' }, function(err, category2) { | ||
should.not.exists(err); |
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.
ditto
@b-admike Sorry, missed the email about the code review results. Fixed. Any additional suggestions according to README? |
@slnode test please |
Looks like someone downgrade MongoDB version which used to run tests. This fixes are required MongoDB 3.4+ |
@slnode test please |
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.
@angfal Thank you for your contribution; LGTM
@slnode test please |
Guys, the version of mongodb is too low that's why my tests fail. How are we going to resolve it? I can check the available mongodb version and skip my tests it if the version is less than 3.4 What do you think about this approach? |
@angfal , could you please rebase your PR? Tests should be running fine now. |
@dhmlau done! |
@slnode test please |
@dhmlau The same error. MongoDB version is less than 3.4 |
it('should create case insensitive indexes', function(done) { | ||
db.automigrate('Category', function() { | ||
db.connector.db.collection('Category').indexes(function(err, result) { | ||
var indexes = [ |
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.
Let's check for err
object here first; if (err) done(err);
test/mongodb.test.js
Outdated
@@ -2652,6 +2677,22 @@ describe('mongodb connector', function() { | |||
}); | |||
}); | |||
|
|||
it('should allow to find using case insensitive index', function(done) { | |||
Category.create({title: 'My Category'}, function(err, category1) { | |||
should.not.exist(err); |
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.
test/mongodb.test.js
Outdated
|
||
Category.find({where: {title: 'my cATEGory'}}, {collation: {locale: 'en', strength: 1}}, | ||
function(err, categories) { | ||
should.not.exist(err); |
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.
if (err) done(err);
test/mongodb.test.js
Outdated
Category.create({title: 'My Category'}, function(err, category1) { | ||
should.not.exist(err); | ||
Category.create({title: 'MY CATEGORY'}, function(err, category2) { | ||
should.not.exist(err); |
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.
if (err) done(err);
@b-admike Fixed. Any ideas what to do withthe mongodb version error (my comment above)? |
@angfal , our CI system is using mongodb version 3.2. Since it will be going to EOL this month, we're planning to update to a newer version of mongodb, as well as making "v3.4 or later" as the requirement. In this case, it will be a new semver-major version for this connector. |
@dhmlau Got it. Let's wait the end of this month then and we can merge it. Thank you |
@slnode test please |
Thank you @angfal! Your patch has landed 🎉 |
@angfal , your changes in this PR is in the newly released |
Description
MongoDB allows to create and search by case insensitive indexes. This fixes add an additional
collation
option for find requests to support this feature.Related issues
Checklist
guide