Cannot filter _deleted items with Datastore syncExpression #14043
Labels
DataStore
Related to DataStore category
pending-maintainer-response
Issue is pending a response from the Amplify team.
pending-triage
Issue is pending triage
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
GraphQL API, DataStore
Amplify Version
v6
Amplify Categories
storage, api
Backend
Amplify CLI
Environment information
Describe the bug
I want to hard delete items from a backend amplify @model generated DynamoDB table which is linked to Datastore client on the my frontend mobile app. I don't think this is possible without accessing Dynamo DB directly from a lambda - and this could cause sync issues with Datastore.
If this is correct, then my next option is filter on the _deleted flag so that the deleted items are never received in my local datastore in my observeQuery.
However, when I try to do this:
I get the error: Property '_deleted' does not exist on type 'V5ModelPredicate'.
If I try to add _deleted to the schema, I get: type ModelGeofenceEventFilterInput has already a field with name _deleted.
How do I access the _deleted flag in syncExpression? Is it possible and if not - what other options do I have?
Expected behavior
Items should be filtered from observeQuery if the _deleted flag is set, and syncExpression is configured to filter these items out.
Reproduction steps
Add this code to a datastore with the above schema
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: