fix: `null` value not persisted for JSON, Any, Object types
fixes #1895 Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
This commit is contained in:
parent
fc8bf0ac1e
commit
7b940a7d98
|
@ -179,10 +179,12 @@ DataAccessObject._forDB = function(data) {
|
||||||
const res = {};
|
const res = {};
|
||||||
for (const propName in data) {
|
for (const propName in data) {
|
||||||
const type = this.getPropertyType(propName);
|
const type = this.getPropertyType(propName);
|
||||||
if (type === 'JSON' || type === 'Any' || type === 'Object' || data[propName] instanceof Array) {
|
const value = data[propName];
|
||||||
res[propName] = JSON.stringify(data[propName]);
|
if (value !== null && (type === 'JSON' || type === 'Any' ||
|
||||||
|
type === 'Object' || value instanceof Array)) {
|
||||||
|
res[propName] = JSON.stringify(value);
|
||||||
} else {
|
} else {
|
||||||
res[propName] = data[propName];
|
res[propName] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Reference in New Issue