I read my response again just to ensure I said the right thing, and I did
say the right thing :)

You misinterpreted my response.

{ "id" : "foo", "bar" : "baz" }

is not equivalent to

{ "id" : "foo", "bar" : { "set" : "baz" }}

As you said, the first doc will result in a doc with just two fields, while
the second will result in just the “bar” field being updated in the
original doc (from the index)

When I say “if your actual doc has 10 fields” I mean the actual doc already
present in the index.

So in your example, say doc with id “foo” has 10 fields in the index, then
the below doc sent in an update will indeed result in a partial update, and
not an error (i.e values for “bar” and “bleh” will be updated and the
remaining fields in the original doc in the index will be retained;
ofcourse copy fields of bar and bleh if any will be updated too)  :

{ "id" : "foo", "bar" : { "set" : "baz" }, "bleh" : "schmeh" }

- Rahul


On Wed, Jul 29, 2026 at 7:32 PM Dmitri Maziuk <[email protected]>
wrote:

> On 7/29/26 18:12, Rahul Goswami wrote:
> ...
> > ==> if the atomic update logic sees a field with modifier in the supplied
> > doc, it treats the update as  atomic (partial) update. So if your actual
> > doc has 10 fields and in your above example in addition to “id” and
> “price”
> > (with “set” modifier) you have a third field say “product” (without
> > modifier), it will be treated as a partial update and all 10 fields
> should
> > still be present post update (ofcourse with the new values for “price”
> and
> > “product”).
>
> So are you saying
>
> { "id" : "foo", "bar" : "baz" }
>
> is equivalent to
>
> { "id" : "foo", "bar" : { "set" : "baz" }}
>
> ??
>
> If true, it's a bug.
>
> The 1st form should replace the original document with what's posted: 2
> fields.
>
> And if you mix full and partial update instructions in the same post, i.e.
> { "id" : "foo", "bar" : { "set" : "baz" }, "bleh" : "schmeh" }
> that should error out.
>
> Dima
>
>

Reply via email to