Skip to content

Commit

Permalink
TIL Object.values in not supported on all browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
IslandRhythms committed Mar 24, 2021
1 parent 391ecec commit c4897f9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,9 @@ function _ensureIndexes(model, options, callback) {

const indexFields = utils.clone(index[0]);
const indexOptions = utils.clone(index[1]);
const textBlock = Object.keys(indexFields).map(function(key) {
return indexFields[key];
});
delete indexOptions._autoIndex;
_decorateDiscriminatorIndexOptions(model, indexOptions);
if ('safe' in options) {
Expand All @@ -1652,7 +1655,7 @@ function _ensureIndexes(model, options, callback) {
indexOptions.background = options.background;
}
if (model.schema.options.hasOwnProperty('collation') &&
!indexOptions.hasOwnProperty('collation') && Object.values(indexFields) != 'text') {
!indexOptions.hasOwnProperty('collation') && textBlock != 'text') {
indexOptions.collation = model.schema.options.collation;
}

Expand Down

0 comments on commit c4897f9

Please sign in to comment.