Skip to content

Commit cd0d935

Browse files
committed
Updating for Mongoose 5.6.13+
The method `pathType` can't handle undefined anymore. So do an extra filter
1 parent c363318 commit cd0d935

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/getAuthorizedFields.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ function getAuthorizedFields(schema, authLevels, action) {
66

77
return _.chain(cleanedLevels)
88
.flatMap(level => schema.permissions[level][action])
9+
.filter() // schema.pathType can't handle undefined values anymore (mongoose gh-6405)
910
.filter(path => schema.pathType(path) !== 'adhocOrUndefined') // ensure fields are in schema
1011
.uniq() // dropping duplicates
1112
.value();

0 commit comments

Comments
 (0)