Search:

Search all manuals
Search this manual
Manual
Membase Client Library: Python
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
5 Membase Client Library: Python — Update Operations
Chapter Sections
Chapters

5.2. Prepend Methods

The prepend() methods insert information before the existing data for a given key. Note that as with the append() method, the information will be inserted before the existing binary data stored in the key, which means that serialization of complex objects may lead to corruption when using prepend().

API Callobject.prepend(key, value [, casunique ])
Asynchronousno
Description Prepend a value to an existing key
Returnsobject ( Binary object )
Arguments 
key Document ID used to identify the value
object value Value to be stored
int casunique Unique value used to verify a key/value combination

The prepend() inserts information before the existing data stored in the key/value pair. The prepend() function requires a CAS value.

For example, to prepend a string to an existing key:

casv = membase.get("samplekey")
membase.prepend(casv[0],"samplekey", "prependedstring")