Skip to content

Commit

Permalink
Update readme to include projection info
Browse files Browse the repository at this point in the history
  • Loading branch information
zarathustra323 committed Jul 6, 2018
1 parent 19b2e19 commit 4520344
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { Pagination } = require('@limit0/mongoose-graphql-pagination');
```
Use the class constructor to configure the settings for the paginated query.

#### constructor(Model, { criteria = {}, pagination = {}, sort = {} }, options = {})
#### constructor(Model, { criteria = {}, pagination = {}, sort = {}, projection }, options = {})
`Model`: The Mongoose model instance to query. _Required._

`criteria`: A query criteria object to apply to the paginated query. Can be any MongoDB query. For example: `{ deleted: false }` or `{ age: { $gt: 30 } }`. Optional.
Expand All @@ -25,6 +25,8 @@ Use the class constructor to configure the settings for the paginated query.

`sort`: Specifies the sort options. The `field` property specifies the field to sort by, and the order defines the direction. For example: `{ field: 'name', order: -1 }` would sort the edges by name, descending. By default the edges are sorted by ID, ascending. Optional.

`projection`: Specifies the fields to return from the database. For example: `{ field: 1 }` or `{ field: 0 }` would include or exclude the specified field, respectively. If left `undefined`, or as an empty object, all fields will be returned (which is the default behavior). Optional.

`options`: Specifies additional configuration options, such as default limit, max limit, sort collation, and sort created field.

Complete example:
Expand Down

0 comments on commit 4520344

Please sign in to comment.