Skip to content

Commit

Permalink
Update getRelatedIndexes.js
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 authored Dec 21, 2023
1 parent bfed8a6 commit 909c773
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/helpers/indexes/getRelatedIndexes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const hasDollarKeys = require('../query/hasDollarKeys');

function getRelatedSchemaIndexes(model, schemaIndexes) {
return getRelatedIndexes({
baseModelName: model.baseModelName,
Expand Down Expand Up @@ -48,7 +50,7 @@ function getRelatedIndexes({
const partialFilterExpression = getPartialFilterExpression(index, indexesType);
return !partialFilterExpression
|| !partialFilterExpression[discriminatorKey]
|| partialFilterExpression[discriminatorKey]['$exists'];
|| (hasDollarKeys(partialFilterExpression[discriminatorKey]) && !('$eq' in partialFilterExpression[discriminatorKey]));
});
}

Expand Down

0 comments on commit 909c773

Please sign in to comment.