You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you update a record and the schema includes default values, any properties that are not explicitly provided in the update will be replaced with their default values.
This will cause the value of the fieldTwo``{{ field to be updated to }}``DEFAULT_VALUE, even though we didn't explicitly specify this property when performing the update.
from docs:
declare enum UpdateMode {
/**
* Objects are only created. If an existing object exists, an exception is thrown.
*/
Never = "never",
/**
* If an existing object exists, only properties where the value has actually
* changed will be updated. This improves notifications and server side
* performance but also have implications for how changes across devices are
* merged. For most use cases, the behavior will match the intuitive behavior
* of how changes should be merged, but if updating an entire object is
* considered an atomic operation, this mode should not be used.
*/
Modified = "modified",
/**
+ * If an existing object is found, all properties provided will be updated,+ * any other properties will remain unchanged. <==========
*/
All = "all"
}
Expected behaviour
Default values should be used only when the property is missing, and this should happen exclusively when you're creating a new record that doesn't already exist.
Version
12.1.0
What services are you using?
Local Database only
Are you using encryption?
Yes
Platform OS and version(s)
iOS 16.4
The text was updated successfully, but these errors were encountered:
@N3TC4T Thank you for reporting. For your details, I believe we can easily write a test to reproduce the bug. Out of curiosity (before writing the test), do you observe the same if you use Modified as mode?
How frequently does the bug occur?
Always
Description
When you update a record and the schema includes default values, any properties that are not explicitly provided in the update will be replaced with their default values.
Note: This only happens after upgrading to
v12
Schema
Creating the record
Updating the record
This will cause the value of the
fieldTwo``{{ field to be updated to }}``DEFAULT_VALUE
, even though we didn't explicitly specify this property when performing the update.from docs:
Expected behaviour
Default values should be used only when the property is missing, and this should happen exclusively when you're creating a new record that doesn't already exist.
Version
12.1.0
What services are you using?
Local Database only
Are you using encryption?
Yes
Platform OS and version(s)
iOS 16.4
The text was updated successfully, but these errors were encountered: