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 Call | object.prepend(key, value [, casunique ]) | ||
| Asynchronous | no | ||
| Description | Prepend a value to an existing key | ||
| Returns | object (
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 = couchbase.get("samplekey") couchbase.prepend(casv[0],"samplekey", "prependedstring")