Skip to content

Commit dc42cb2

Browse files
authored
Merge pull request #12721 from lpizzinidev/fix-cast-cleanup
fix: code cleanup in `getStrictQuery` function
2 parents 8a4fe03 + aad988d commit dc42cb2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/cast.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,11 @@ function getStrictQuery(queryOptions, schemaUserProvidedOptions, schemaOptions,
387387
if ('strict' in schemaUserProvidedOptions) {
388388
return schemaUserProvidedOptions.strict;
389389
}
390-
if (
391-
context.mongooseCollection &&
390+
const mongooseOptions = context.mongooseCollection &&
392391
context.mongooseCollection.conn &&
393392
context.mongooseCollection.conn.base &&
394-
context.mongooseCollection.conn.base.options) {
395-
const mongooseOptions = context.mongooseCollection.conn.base.options;
393+
context.mongooseCollection.conn.base.options;
394+
if (mongooseOptions) {
396395
if ('strictQuery' in mongooseOptions) {
397396
return mongooseOptions.strictQuery;
398397
}

0 commit comments

Comments
 (0)