Skip to content

Commit bc4ad99

Browse files
author
William Sedlacek
authored
docs(graphql): Complexity on Query and Mutation
Related PR nestjs/graphql#1088
1 parent 8cb2d73 commit bc4ad99

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

content/graphql/complexity.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,14 @@ Alternatively, you can define the estimator function:
8484
@Field({ complexity: (options: ComplexityEstimatorArgs) => ... })
8585
title: string;
8686
```
87+
88+
#### Query/Mutation-level complexity
89+
90+
Additionally, `@Query()` and `@Mutation()` may have a `complexity` property specified like so:
91+
92+
```typescript
93+
@Query({ complexity: (options: ComplexityEstimatorArgs) => options.args.count * options.childComplexity })
94+
items(@Args('count') count: number) {
95+
return itemsService.getItems({ count });
96+
}
97+
```

0 commit comments

Comments
 (0)