Update body (jsonb) and field at once
ritwickdey opened this issue · comments
Summary
db.tests.update(id, { firstName: 'Ritwick' })
// this only update Field.
db.tests.updateDoc(id, { someProps: 'foo' })
// this only update body (jsonb) Field.
But I can't do
db.tests.update(id, { firstName: 'Ritwick', body: { someProps: 'foo' } })
Have you tried? Did you receive an error message, did one or both fields retain their previous values, what happened? "I can't do" doesn't give me anything to go on. Please use the full issue template.
I can tell you that I've used update
to modify mixed ordinary and JSON values going back to Massive v2, and that this testcase passes:
it('updates mixed column types', function () {
return db.normal_pk.update(1, {field1: 'zeta', json_field: {a: 'b', c: {d: 'e'}}}).then(res => {
assert.equal(res.id, 1);
assert.equal(res.field1, 'zeta');
assert.deepEqual(res.json_field, {a: 'b', c: {d: 'e'}});
});
});
Hi @dmfay, Sorry for late reply.
It actually override the existing body
object.
Is this possible to patch body
object ?