-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
amplify/dataIssue related to aws-amplify/amplify-category-apiIssue related to aws-amplify/amplify-category-api
Description
Describe the content issue:
A clear and concise description of what the content issue is. Is there content missing or is there incorrect content?
The following code snippet is incorrect:
await DataStore.save(
new Post({
title: 'My First Post',
rating: 10,
status: PostStatus.INACTIVE
}),
(p) => p.title.beginsWith('[Amplify]')
);
The predicate here does nothing, and each save that utilizes a predicate will create a new record (not conditionally update an existing record, as would be expected). The code snippet should instead be as follows:
await DataStore.save(
Post.copyOf(original, updated => {
updated.title = 'My First Post';
}),
p => p.title.beginsWith('[Amplify]')
);
URL page where content issue is:
https://docs.amplify.aws/lib/datastore/sync/q/platform/js/#update-and-delete-with-predicate
Metadata
Metadata
Assignees
Labels
amplify/dataIssue related to aws-amplify/amplify-category-apiIssue related to aws-amplify/amplify-category-api