Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.

Commit 502d147

Browse files
committed
COMPASS-185: Update for collations
1 parent 570b2b3 commit 502d147

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/model.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ var IndexModel = Model.extend({
8989
return !!this.extra.textIndexVersion;
9090
}
9191
},
92+
collation: {
93+
deps: ['extra'],
94+
fn: function() {
95+
return !!this.extra.collation;
96+
}
97+
},
9298
type: {
9399
deps: ['geo', 'hashed', 'text'],
94100
fn: function() {
@@ -111,18 +117,19 @@ var IndexModel = Model.extend({
111117
}
112118
},
113119
properties: {
114-
deps: ['unique', 'sparse', 'partial', 'ttl'],
120+
deps: ['unique', 'sparse', 'partial', 'ttl', 'collation'],
115121
fn: function() {
116122
var model = this;
117-
var props = ['unique', 'sparse', 'partial', 'ttl'];
123+
var props = ['unique', 'sparse', 'partial', 'ttl', 'collation'];
118124
return _.filter(props, function(prop) {
119125
return !!model[prop];
120126
}).sort(function(a, b) {
121127
var order = {
122128
'unique': 1,
123129
'sparse': 2,
124130
'partial': 3,
125-
'ttl': 4
131+
'ttl': 4,
132+
'collation': 5
126133
};
127134
return order[a] - order[b];
128135
});

test/index.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ describe('mongodb-index-model', function() {
5151
assert.equal(index.compound, false);
5252
assert.equal(index.geo, false);
5353
assert.equal(index.partial, false);
54+
assert.equal(index.collation, false);
5455
});
5556

5657
it('should recognize geo indexes', function() {

0 commit comments

Comments
 (0)