The replace() methods update an existing
key/value pair in the database. If the specified key does not
exist, then the operation will fail.
| API Call | object.replace(key, expiry, flags, value) | ||
| Asynchronous | no | ||
| Description | Update an existing key with a new value | ||
| Returns | object (
Binary object
) | ||
| Arguments | |||
key | Document ID used to identify the value | ||
expiry | Expiry time for key. Values larger than 30*24*60*60 seconds (30 days) are interpreted as absolute times (from the epoch). | ||
flags | Flags for storage options. Flags are ignored by the server byt preserved for use by the client. | ||
object value | Value to be stored | ||
The first form of the replace() method
updates an existing value setting while supporting the explicit
setting of the expiry time on the item. For example to update the
samplekey:
couchbase.replace("samplekey",0,0,"updatedvalue");