In Hoist does Hoist.data().save(obj) overwrite the object or merge it?

40 Views Asked by At

When I save an object into Hoist data when there is an existing _id does it merge the object or overwrite it?

For example:

Hoist.data("FOO").findById("a")

returns

{ _id: "a", hash: "moose", prop2: "asda" }

after

Hoist.data("FOO").save( { _id: "a", hash: "moo" })

is the result going to be

{ _id: "a", hash: "moo" } or { _id: "a", hash: "moo", prop2: "asda" }

1

There are 1 best solutions below

0
On

It performs a merge on the existing object with the new object.

So the result will be { _id: "a", hash: "moo", prop2: "asda" }