Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
pbatey committed Mar 9, 2015
1 parent 300a4e1 commit b2f5950
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,11 @@ For example, a query such as: `name=john&age>21&fields=name,age&sort=name,-age&o
{
criteria: {
name: 'john',
age: {
$gt: 21
}
age: { $gt: 21 }
},
options: {
fields: {
name: true,
age: true
},
sort: {
name: 1,
age: -1
},
fields: { name: true, age: true },
sort: { name: 1, age: -1 },
offset: 10,
limit: 10
}
Expand All @@ -36,8 +28,6 @@ collection.find(query.criteria, query.options).toArray(function(err, results) {
})
```

The format for arguments was inspired by item #7 in [this article](http://blog.mwaysolutions.com/2014/06/05/10-best-practices-for-better-restful-api/) about best practices for RESTful APIs.

## Install
```
$ npm install query-to-monogdb
Expand Down Expand Up @@ -97,6 +87,8 @@ router.get('/api/v1/mycollection', function(req, res, next) {
}
```

The format for arguments was inspired by item #7 in [this article](http://blog.mwaysolutions.com/2014/06/05/10-best-practices-for-better-restful-api/) about best practices for RESTful APIs.

### Field selection
The _fields_ argument is a comma separated list of field names to include in the results. For example `fields=name,age` results in a _option.fields_ value of `{'name':true,'age':true}`. If no fields are specified then _option.fields_ is null, returning full documents as results.

Expand Down

0 comments on commit b2f5950

Please sign in to comment.