Skip to content

Commit

Permalink
fix projectionHelper: make projection flat
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed Jul 20, 2016
1 parent 72813c7 commit 846cbd0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/resolvers/helpers/projection.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import type {
export function projectionHelper(resolveParams: ExtendedResolveParams): void {
const projection = resolveParams.projection;
if (projection) {
resolveParams.query = resolveParams.query.select(projection); // eslint-disable-line
const flatProjection = {};
Object.keys(projection).forEach(key => {
flatProjection[key] = !!projection[key];
});
resolveParams.query = resolveParams.query.select(flatProjection); // eslint-disable-line
}
}

0 comments on commit 846cbd0

Please sign in to comment.