Skip to content
This repository was archived by the owner on Jul 14, 2019. It is now read-only.

Commit 204eab6

Browse files
committed
Support of compound indexes
1 parent 76221b7 commit 204eab6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ module.exports = exports = {
142142
schema.post(key, record);
143143
}
144144

145+
//Array of indexes
146+
if (modelData.hasOwnProperty('indexes'))
147+
for (var i=0; i<modelData.indexes.length; i++) {
148+
var index = modelData.indexes[i];
149+
schema.index(index.fields, index.options);
150+
}
151+
145152
// If autoIncrementIds:true then utilize mongoose-auto-increment plugin for this model.
146153
if (settings.autoIncrementNumberIds) {
147154
var field = settings.autoIncrementSettings.field;

0 commit comments

Comments
 (0)