rethink-decl
Allows you to create RethinkDB queries from options objects. Useful for dealing grabbing querystring parameters and turning them into a query in an API endpoint.
Install
npm install rethink-decl --save
API
decl(model, options)
model
is a thinky model objectoptions
is your object full of optionslimit
- Type: Number
- Controls maximum number of results
offset
- Type: Number
- Controls which offset to start reading from
sort
- Type: Array of field names or comma-separated field names
- Ascending by default
- Prefix field names with - for descending
- Any other options will be treated as a filters
- Returns the query
Be advised: There is no default limit. All results will be returned.
Example
var decl = var User = thinky // find me 5 users with the name 'Eric'// start at offset 5// this is equiv to fetching page #2