#community-help

Updating Patch Documents in Typesense

TLDR Jason queried about possible patch document updates, Jason confirmed this and provided necessary links. Differences between update, upsert and emplace were clarified.

Powered by Struct AI
6
10mo
Solved
Join the chat
Dec 02, 2022 (10 months ago)
Jason
Photo of md5-c7ebbbcac16a1763e16d0e8e8177b0ae
Jason
03:59 AM
Are patch document updates possible? e.g., leave fields in place which are not part of the update?
Jason
Photo of md5-c7ebbbcac16a1763e16d0e8e8177b0ae
Jason
04:01 AM
so given a document
{
  foo: 1
  bar: 2
}

and update consisting of
{
  foo: 2
}

will update foo and leave bar in place?
04:09
Jason
04:09 AM
I see, it works with update though not upsert
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:22 AM
Correct, upsert expects the full document. update accepts partial.
04:22
Jason
04:22 AM
There’s also emplace