Skip to content

Commit ea8afe1

Browse files
committed
Fix "collection.createIndex"
Fix "collection.createIndex" fail, when "relationshipAttributeNames" isn't defined
1 parent c233c62 commit ea8afe1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/mongoHandler.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ MongoStore.prototype._createIndexesForRelationships = function(collection, relat
153153
partialIndex[name + ".id"] = 1;
154154
return partialIndex;
155155
}, {});
156-
collection.createIndex(index);
156+
157+
if (Object.keys(index).length) {
158+
collection.createIndex(index);
159+
}
157160
};
158161

159162

0 commit comments

Comments
 (0)