MutateIn with upsert option and remove action

Hi

I have a json looking like that in the DB

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

And I want to create it if it doesn’t exist and remove the fooz key if it exists.
If I run

myBucket.mutateIn(id, { upsert: true })
.upsert('foo", "bar")
.remove("fooz")
.execute(() => {})

I receive a code 75 error (“A badly formatted packet was sent to the server. Please report this in a bug”)
So, I am sure, it comes from the upsert option that seems to be incompatible with the remove.

Is that a bug ? Is there a workaround different than

myBucket.insert(id, value, () => {
    myBucket.mutateIn(id, {})
        .remove(currentMatchDay)
        .execute(() => {});
});
1 Like

IIRC, that may be correct in that it’s a restriction on Sub-Document. @brett19 may know off the top of his head.

That said, it shouldn’t fail like that. It should perhaps fast fail at the client. Can you share what versions of the client/server you were using?

Hey @baptiste,

It looks like there may be a bug in the client or server. As @ingenthr mentioned, it would be great to get some information about your environment such that we can try to reproduce it locally.

Looking at what you are performing, I think the semantics are clear and unambiguous, so it should work. There isn’t any conflict between the remove and the upsert mode like there might be with a remove against a subdocument in insertion mode.

Cheers, Brett

Hey

Sorry, I should have started with that…

We are using the 2.4.6 client for nodejs and the 5.5.2 entreprise version for the server

Thanks

Baptiste

Encoutering the same bug for upserting a very big JSON

Facing the same bug but only if removing a property from a subdocument:

bucket.mutateIn(id)
 .remove("source.accepted")
 .upsert("modifiedDate", new Date())
 .execute(() => {}

couchbase sdk for node js ^2.6.11