1

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" }

buildmaster
  • 308
  • 1
  • 11
Andrew Cox
  • 10,672
  • 3
  • 33
  • 38

1 Answers1

2

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

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

jamie-wilson
  • 1,925
  • 21
  • 38