remove deps
Rewrite from scratch
- ObjectId
Query.on '_', (name, value)->
function must return object for mongo
Query.off '_'
- url: /api/item?name=_53c699da9189110000454007
- name: ObjectId(53c699da9189110000454007)
"use strict"
_ = require("lodash")
Item = require("./item.model")
Query = require("wc-query")
fields = {}
# Get list of items
exports.index = (req, res) ->
query = Query(req.query)
Item.find query.conditions, fields, query.options, (err, items) ->
throw err if err
return handleError(res, err) if err
res.json 200, items
- /?or='name=3,test=!4'
- { '$or': [ { name: '3' }, { test: $ne :4 } ] }
- /?and='name=3,test=!4'
- { '$and': [ { name: '3' }, { test: $ne :4 } ] }
- url: /api/item?name=test
- name: 'test'
-
url: /api/item?name=%2B
- name: $exists: true
-
url: /api/item?name=-
- name: $exists: false
- url: /api/item?name=_53c699da9189110000454007
- name: ObjectId(53c699da9189110000454007)
- url: /api/item?name=!test
- name: $ne: 'test'
- url: /api/item?name=>1
- name: $gt: 1
- url: /api/item?name=]1
- name: $gte: 1
- url: /api/item?name=<1
- name: $lt: 1
- url: /api/item?name=[1
- name: $lte: 1
- url: /api/item?name=@1|2|3
- name: $in: ['1','2','3']
- url: /api/item?name=#1|2|3
- name: $nin: ['1','2','3']
- url: /api/item?name=~test
- name: $regex: 'test'
- /api/item?order=name
- options.sort:{name:1}
- /api/item?order=-name
- options.sort:{name:-1}
- /api/item?limit=25&skip=0
- options.sort:{skip:0,limit:25}