I have an existing database collection. The collection already has multiple documents. I tried to add a new attribute called "rating" with default value of 0. The attribute was added in all documents but its value was set to "null" rather than 0.
Isn't it a bug ?
How to set it to 0 ?
Summary
The user wants to add a new attribute called "rating" with a default value of 0 to an existing database collection. However, when they tried to do so, the value of the attribute was set to "null" instead. They are asking if this is a bug and how to set the value to 0.
The response states that this is an expected behavior in Appwrite and that the system does not automatically set values for old documents. The user is advised to use a server SDK to update the old documents. A link to a specific solution is provided in the response.
Solution: Use a server SDK to update the old documents
Chola
Rank 2: Process
Jun 8, 2023, 19:32
I noticed when i set a default boolean value in my collection i was also just getting null, even from the console it didn't reflect.
Looks like a bug, let's see what the Pro's have to say
Drake
Admin
Jun 9, 2023, 01:07
This is expected. Appwrite doesn't automatically set the value for old documents. You can use a server SDK to update old documents: