CouchbaseMetaDoc properties type

Sample of CouchbaseMetaDoc :

class CouchbaseMetaDoc#9 (5) {
    public $error => NULL
    public $value => string(21) '{"name": "Palaiseau"}',
    public $flags => int(0)
    public $cas => string(9) "xc7a86cyc"
    public $token => NULL

I try to find type of each properties.
value is obviously mixed PHP type.
flags is int PHP type.
cas is string PHP type.
token ? dunno I can’t have a case where token is filled, i think it’s string.
error ? According to this post Flags in CouchbaseMetaDoc Object it seems to be a CouchbaseException object.

But i can’t have a case where error is filled. When there is a problem (like no such key), i got an exception and no CouchbaseMetaDoc object.

So can you help me to find type of token and error please.

It is CouchbaseMutationToken, which represented like this (but it is not supposed to be created by user):

class CouchbaseMutationToken {
    public $bucket; // string
    public $vbucketID; // int
    public $vbucketUUID; // string
    public $sequenceNumber; // int

The following code will output CouchbaseException:

$cluster = new CouchbaseCluster("couchbase://localhost");
$bucket = $cluster->openBucket("default");

$res = $bucket->retrieveIn('myDoc', 'missing/path');
printf("%s\n", get_class($res->error));

Ok thanks :slight_smile:
Don’t forget to add type into PHP stub.
I can make PR if you want above some things like that.

Yes, sure. I’m reordering it a bit to resolve performance issue with eval, but I will make sure that everything will be discoverable.