Links

Example: Filters

Use the following query option to apply filters:

filters

Type: Comfortable.Filter collect or reduce documents by certain field values
const api = Comfortable.api('<repository-api-id>', '<api-key>');
var options = {
filters: new Comfortable.Filter()
.addAnd('title', 'like', '%Hello%')
.addAnd('date', 'greaterThan', '2018-07-04')
.addOr('topNews', 'equal', true)
/** filter by document id **/
.addAnd('id', 'equals', '123123123432425', 'meta')
/** filter blogPosts (contentType) by title **/
.addAnd('title', 'like', '%Hello%', 'fields', 'blogPosts')
// syntax
// .addAnd(property: string(<id|title|...>), operator: string(<equals|like|...>), value: any, context: string(<fields|meta>), contentType: string(<*|contentTypeApiId>))
// .addOr(property: string(<id|title|...>), operator: string(<equals|like|...>)), value: any, context: string(<fields|meta>), contentType: string(<*|contentTypeApiId>))
}
api.getDocuments(options)
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})