Skip to content

Releases: pbatey/query-to-mongo

Support Omit parameter

02 Sep 19:04
Compare
Choose a tag to compare

The omit argument is a comma separated list of field names to exclude in the results. For example omit=name,age results in a option.fields value of {'name':false,'age':false}. If no fields are specified then option.fields is null, returning full documents as results.

Note that either fields or omit can be used. If both are specified then omit takes precedence and the fields entry is ignored. Mongo will not accept a mix of true and false fields.

Publish to npm

24 Mar 19:55
Compare
Choose a tag to compare

This publish to npm replaces Julian Duniec's initial version 0.0.1.

The initial version did not contain a README.md file, but you can infer from the code that it converted query parameters parsed by querystring into a mongo query. It supported only numeric comparisons, and the following operators: $gte, $gt, $lte, $lt, $ne.

For example it converts age=$gte(21) into { age: { '$gte': 21 } }.

With this version, numeric queries are less syntax-y: age>=21, and it now supports string, boolean, and date queries.