Skip to content

Commit

Permalink
Update CRUD.md modifying database example
Browse files Browse the repository at this point in the history
Updated the example showing how to use database.write to include a proper implementation of the `.update` method where the record to modify comes from the arg in the update callback.
  • Loading branch information
trumpet2012 authored Sep 25, 2024
1 parent a757e64 commit 842b1ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs-website/docs/docs/CRUD.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ All modifications to the database (like creating, updating, deleting records) mu

```js
await database.write(async () => {
const comment = await database.get('comments').find(commentId)
await comment.update(() => {
const someComment = await database.get('comments').find(commentId)
await someComment.update((comment) => {
comment.isSpam = true
})
})
Expand Down

0 comments on commit 842b1ca

Please sign in to comment.