Skip to content

Commit

Permalink
Update Readme (#81)
Browse files Browse the repository at this point in the history
Add note about passing nedb options client.
  • Loading branch information
toddgeist authored and daffl committed Jun 29, 2019
1 parent ae3b207 commit a1a7120
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@ app.service('messages').update('someid', {
});
```

### use of params on client
On client you can't pass anything other than a query as the parameter. So you need to do it like this.

```js
// client side
app.service('messages').update('someid', {
text: 'This message will be either created or updated'
}, {
query: {nedb: { upsert: true }}
});
```
then add a hook to the service to move the nedb options to the params object
```js
ctx => {
const nedb = ctx.params.query.nedb;
if (nedb) {
ctx.params.nedb = nedb;
delete ctx.params.query.nedb;
}
return ctx;
}
```

## Example

Here is an example of a Feathers server with a `messages` NeDB service that supports pagination and persists to `db-data/messages`:
Expand Down

0 comments on commit a1a7120

Please sign in to comment.