divadpoc
divadpoc

Reputation: 933

ArangoDB - update vs. replace

I'm curious about the difference (except the obvious one) between update and replace of a document within ArangoDB.

When is it best to use update, and when is it best to use replace?

Thanks

Upvotes: 3

Views: 474

Answers (2)

Robin
Robin

Reputation: 451

There is a big difference. If your collection has a Array/List/Dictionary etc, updating will not remove values, you need to replace it.

Upvotes: 1

CodeManX
CodeManX

Reputation: 11885

Use whatever is best for you to modify your documents. There should be little to no difference in performance, because new document revisions are written either way (append only principle).

Just make sure you don't unset a lot of attributes and replace the document by accident instead of updating a few attributes only.

Upvotes: 1

Related Questions