Skip to content

Commit

Permalink
fix(schema): treat { type: mongoose.Schema.Types.Array } as equival…
Browse files Browse the repository at this point in the history
…ent to `{ type: Array }`

Fix #9194
  • Loading branch information
vkarpov15 committed Jul 4, 2020
1 parent 378f59b commit 3390c53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,9 +897,9 @@ Schema.prototype.interpretAsType = function(path, obj, options) {
return new MongooseTypes.Mixed(path, obj);
}

if (Array.isArray(type) || Array === type || type === 'array') {
if (Array.isArray(type) || type === Array || type === 'array' || type === MongooseTypes.Array) {
// if it was specified through { type } look for `cast`
let cast = (Array === type || type === 'array')
let cast = (type === Array || type === 'array')
? obj.cast
: type[0];

Expand Down

0 comments on commit 3390c53

Please # to comment.