Remove extra lookup value (#1058)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2022-02-25 15:05:55 +06:00 committed by GitHub
parent 6e934b83aa
commit c7bfa1b295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -240,10 +240,20 @@ abstract class MongoAdapterBase extends TxProcessor {
for (const row of result) {
row.$lookup = {}
await this.fillLookupValue(options.lookup, row)
this.clearExtraLookups(row)
}
return result
}
private clearExtraLookups (row: any): void {
for (const key in row) {
if (key.endsWith('_lookup')) {
// eslint-disable-next-line
delete row[key]
}
}
}
private checkMixinKey<T extends Doc>(key: string, clazz: Ref<Class<T>>): string {
if (!key.includes('.')) {
try {