Skip to content

Commit

Permalink
made requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
IslandRhythms committed Mar 29, 2021
1 parent c9bfb30 commit d1a9a1e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1633,12 +1633,11 @@ function _ensureIndexes(model, options, callback) {

const indexFields = utils.clone(index[0]);
const indexOptions = utils.clone(index[1]);
const textBlock = () => {
const results = Object.keys(indexFields).map(function(key) {
return indexFields[key];
});
if (results.indexOf('text') !== -1) {
return false;
const noText = () => {
for (const key in indexFields) {
if (indexFields[key] == 'text') {
return false;
}
}
return true;
};
Expand All @@ -1661,7 +1660,7 @@ function _ensureIndexes(model, options, callback) {
indexOptions.background = options.background;
}
if (model.schema.options.hasOwnProperty('collation') &&
!indexOptions.hasOwnProperty('collation') && textBlock()) {
!indexOptions.hasOwnProperty('collation') && noText()) {
indexOptions.collation = model.schema.options.collation;
}

Expand Down

0 comments on commit d1a9a1e

Please sign in to comment.