Hello,
I am getting this error and I don’t know what is the problem. Can please somebody help me identify the problem?
Couchbase\DurabilityException: LCB_ERR_DURABILITY_AMBIGUOUS
I used it like this in my code
static function insertDocument ($documentKey, $documentValue, $bucketName, $objCbOptions = array())
{
/*
$objCbOptions = array (
'expirySeconds' => <int>,
'timeoutSeconds' => <int>,
'durabilityLevel' => None = 0; Majority = 1; MajorityAndPersistActive = 2; PersistToMajority = 3
)
*/
$opts = null;
if (!empty($objCbOptions)) {
$opts = new \Couchbase\InsertOptions();
if (!empty($objCbOptions['expirySeconds'])) {
$opts->expiry($objCbOptions['expirySeconds']);//in documentation is written milliseconds, but in reality it seems to be seconds
}
if (!empty($objCbOptions['timeoutSeconds'])) {
$opts->timeout($objCbOptions['timeoutSeconds']);//in documentation is written milliseconds, but in reality it seems to be seconds
}
if (!empty($objCbOptions['durabilityLevel'])) {
$opts->durabilityLevel($objCbOptions['durabilityLevel']);
}
}
return CouchbaseClient::getCollection($bucketName)->insert($documentKey, $documentValue, $opts);