When applying a DeltaLong to a value, the case of non-initialized property (null) must be treated properly because:
- on VCS we cannot increment a NULL value (UPDATE table SET col = col + 100 gives NULL on NULL columns).
- on MongoDB we have to make sure that there is no field set and not an actual null value (because $inc does the right thing on a non-existent field but fails on a null value with the following error.
Cannot apply $inc to a value of non-numeric type. {_id: ObjectId('573167aac9e77c68ffe32e5a')} has the field 'dss:sizeTrash' of non-numeric type NULL
So we must:
- make sure we always know exactly what we expect to be stored in the database, so avoid schemas with default values,
- store in the DeltaLong the expected base value including when it is null,
- on MongoDB unset fields that are null,
- on VCS only increment when the base of the DeltaLong is not null, otherwise do a normal store.
- is required by
-
NXP-19662 Fix deltas after set without intervening save
- Resolved
-
NXP-19596 Fix MongoDB DocumentSizeUpdater tests
- Resolved
-
NXDOC-2228 The doc about DeltaLong should mention DeltaLong.valueOf
- Resolved