mongoose-datatables
Server side table request.
Installation
$ npm install mongoose-datatables
Usage
Configure the plugin in your model
var mongoose = var dataTables = var Schema = mongooseSchema var UserSchema = first_name: String last_name: String username: String UserSchema
Use plugin in your route
app;
API
plugin([options])
options.totalKey
(String) - Default totaloptions.dataKey
(String) - Default dataoptions.formatters
(Object) - Specifies multiple formatters that can be used in the query
dataTables([options], [callback])
options.limit
(Number) - Specifies mongo limit.options.skip
(Number) - Specifies mongo skip.options.find
(Object) - Specifies selection criteria.options.select
(Object) - Specifies the fields to return.options.sort
(Object) - Specifies the order in which the query returns matching documents.options.order
,options.columns
(Array), (Array) - Specifies the order in which the query returns matching documents and replace the sort optionoptions.search
(Object) - Search.options.populate
(Object) - Specifies models to populate.options.formatter
(String|Function) - Specifies formatter to use after the query.
Formaters
At query level
User
At schema level
UserSchema;
Use by doing this at query level
User
Note: if you use formatters you get an array of objects on data, instead of the model instance.
License
MIT