eherve / mongoose-datatable

Server side dataTable request support for mongoose
MIT License
42 stars 29 forks source link

mongo query filters in Model.dataTable(query,callBAck) #34

Closed pradeepch closed 5 years ago

pradeepch commented 8 years ago

How can i include other filters in query for data in Model.dataTable(query,callBAck)? for example i want to apply following filters to the query while fetching data: [ { '$match': { 'xform.id': '55c4a5d97a7556b6348f7bd9', 'meta.end': { '$gte': Wed Aug 05 2015 05:30:00 GMT+0530 (IST), '$lte': Thu Aug 13 2015 05:30:00 GMT+0530 (IST) }, 'meta.center': { '$in': [ '550281ffc07b90fe1c4b6002', '5502aee31bb1f8903225d1c3', '556e88c3d727fa500e4b1bbe' ] } } } ] Please reply asap, thanks in advance.

eherve commented 8 years ago

Hi,

You can pass conditions to the dataTable function via options.conditions.

It is explained in the Readme:

Conditions is an object as the mongoose find conditions. This conditions filter the dataTable data returned and the counts, it is applied as the first conjunction condition.

Regards,