jesusOriginal post
Rank 3: Container
Hi,
Just a question...
I've set the AMOUNT attribute type as an intger in appwrite, why it accepts Strings ?
If i pass the number as String like this "5000" appwrite accepts it !!
Plain text
'DatabaseId, 'CollectionId', { "AMOUNT": "50000" } );```
When using a function event to listen to any create and print the req.body the AMOUNT appears as String ?
Why the create document doesn't throw an error ?Summary
Developers are wondering why the 'int' attribute in Appwrite is accepting numbers as a string. Even when passing a number as a string, such as "5000," Appwrite doesn't throw an error and accepts it. This behavior occurs when using a function event to listen to creations.
Solution: Appwrite is accepting numbers as strings due to how the Data API handles inputs. To ensure that the attribute is treated as an integer, developers should explicitly convert the string input to an integer before passing it to the 'AMOUNT' attribute.