amazon-web-servicesdatastoreaws-amplify

AWS Amplify DataStore filtering not working


I'm using AWS Amplify framework, i have a list of products, each product contains a price, when i run :

DataStore.query(Product)

to get all the products it works fine, but when i run the query below to get the products with price greater than 10 :

DataStore.query(Product, c => c.price.gt(10));

i got an error TypeError: c.price.gt is not a function !

this is how it described in docs


Solution

  • This way below worked perfectly !

    DataStore.query(Product, (c) => c.price('gt', 10))