Skip to content

Commit

Permalink
refactor: nop
Browse files Browse the repository at this point in the history
  • Loading branch information
MXPOL committed Dec 4, 2023
1 parent 32bf65b commit bad4188
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default class SchemaAwareDataService {
private async projectionFor(collectionName: string, _projection = [] as string[]) {
const schemaFields = await this.schemaInformation.schemaFieldsFor(collectionName)
const schemaContainsId = schemaFields.some(f => f.field === '_id')
const projection = _projection.length === 0 ? schemaFields.map(f => f.field) : _projection as string[]
const projection = ( Array.isArray(_projection) && _projection.length ) ? _projection as string[] : schemaFields.map(f => f.field)
return schemaContainsId ? Array.from(new Set(['_id', ...projection])) : projection
}
}

0 comments on commit bad4188

Please sign in to comment.