Skip to content

Commit c4897f9

Browse files
committedMar 24, 2021
TIL Object.values in not supported on all browsers
1 parent 391ecec commit c4897f9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎lib/model.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,9 @@ function _ensureIndexes(model, options, callback) {
16331633

16341634
const indexFields = utils.clone(index[0]);
16351635
const indexOptions = utils.clone(index[1]);
1636+
const textBlock = Object.keys(indexFields).map(function(key) {
1637+
return indexFields[key];
1638+
});
16361639
delete indexOptions._autoIndex;
16371640
_decorateDiscriminatorIndexOptions(model, indexOptions);
16381641
if ('safe' in options) {
@@ -1652,7 +1655,7 @@ function _ensureIndexes(model, options, callback) {
16521655
indexOptions.background = options.background;
16531656
}
16541657
if (model.schema.options.hasOwnProperty('collation') &&
1655-
!indexOptions.hasOwnProperty('collation') && Object.values(indexFields) != 'text') {
1658+
!indexOptions.hasOwnProperty('collation') && textBlock != 'text') {
16561659
indexOptions.collation = model.schema.options.collation;
16571660
}
16581661

0 commit comments

Comments
 (0)
Please sign in to comment.