From 4520344cee69cb31eae48d9e6606a92366777a31 Mon Sep 17 00:00:00 2001 From: Jacob Bare Date: Fri, 6 Jul 2018 10:54:29 -0500 Subject: [PATCH] Update readme to include projection info --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3684796..488d050 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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: