fix: sorting by non-existing value throws INVALID_SERVER_ERROR on Postgres (#8157)

This commit is contained in:
dblythy
2022-09-18 04:41:45 +10:00
committed by GitHub
parent 73e1763a63
commit 3b775a1fb8
2 changed files with 13 additions and 0 deletions

View File

@@ -1207,6 +1207,9 @@ class DatabaseController {
`Invalid field name: ${fieldName}.`
);
}
if (!schema.fields[fieldName.split('.')[0]] && fieldName !== 'score') {
delete sort[fieldName];
}
});
return (isMaster
? Promise.resolve()