Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Readme #81

Merged
merged 1 commit into from
Jun 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,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