Search:

Search all manuals
Search this manual
Manual
Couchbase Client Library: Python 1.0
Community Wiki and Resources
Download Client Library
Python Client Library
SDK Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
4 Store Operations
Chapter Sections
Chapters

4.3. Replace Operations

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 Callobject.replace(key, expiry, flags, value)
Asynchronousno
Description Update an existing key with a new value
Returnsobject ( 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");