GetOptionsProcessor

GetOptionsProcessor

new GetOptionsProcessor()

The processor for get actions.

Methods

cached()

Set to cache the result
Example
x.cached()

fields(fields)

Set the fields
Parameters:
Name Type Description
fields object | array The restricted fields
Examples
x.fields(['firstName', 'lastName'])
x.fields({
   firstName: 1,
   lastName: 1
})

options(options)

Set the options
Parameters:
Name Type Description
options object The options
Example
x.options({
   start: 0,
   limit: 50,
   sort: { firstName: 1 }
}})

query(query)

Set the query
Parameters:
Name Type Description
query object | string The query object or the mongodb ObjectId
Examples
x.query('XXX')
x.query({
   firstName: 'John',
   lastName: 'Smith'
})

single(valueopt)

Set to fetch a single result
Parameters:
Name Type Attributes Default Description
value boolean <optional>
true Whether it should fetch a single result or not
Example
x.single()