cf-public-query
v0.0.1
Published
Extends a query object by adding published and visible article criteria
Downloads
4
Readme
cf-public-query
Extends a query object by adding published and visible article criteria
Installation
npm install cf-public-query --save
Usage
var createPublicQuery = require('cf-public-query')
console.log(require('util').inspect(createPublicQuery({ title: 'Article title' }), { depth: null }))
// Returns the following query:
//
// { title: 'Article title',
// state: 'Published',
// '$and':
// [ { '$or':
// [ { liveDate: null },
// { liveDate: { '$lte': Tue May 20 2014 11:51:02 GMT+0100 (BST) } } ] },
// { '$or':
// [ { expiryDate: null },
// { expiryDate: { '$gte': Tue May 20 2014 11:51:02 GMT+0100 (BST) } } ] } ] }
var query = createPublicQuery(query)
Options must include:
query
- a query object to be extended with visible and published criteria