N1QL update error on "big" documents

I’m getting the following error when trying to update a “big” document (~22MB).

UPDATE bucketName SET somefield = "value" WHERE (feild="value1") 
    "code": 12009,
    "msg": "DML Error, possible causes include CAS mismatch or concurrent modificationFailed to perform update - cause: MCResponse status=E2BIG, opcode=SET, opaque=0, msg: Too large"

I didn’t find any documatation of this limitation in https://developer.couchbase.com/documentation/server/current/n1ql/n1ql-language-reference/update.html

  1. What is the limit?
  2. Is it hardcoded in the server?
  3. Does this error code have exported enum in nodejs SDK?
  4. Are there any intention to support this?

MAX JSON document size is 20MB in cocuhbase https://developer.couchbase.com/documentation/server/4.6/clustersetup/server-setup.html

Oh, so it is for all operations ? Including key-value?
Actually, all operations are woking except of UPDATE is this expected?

The error is returned by memcached. That means same thing should have failed key-value too. cc @drigby

Maximum document size is 20MB. It’s enforced at the Data Service, so either a direct KV operation or via N1QL will trigger the same error.