How to get the revision property of a document on Couchbase Server using SDK

I’m trying to consistently get the revision property of a document on couchbase server as well as metadata.
I’m hoping to get this via the .Net SDK.

The implementation of n1ql and the .Net SDK and the admin interface seems to be confused with what should be returned as a document, especially with regards to what metadata is and should return as such.
It is returning a different set of metadata in all three cases
N1ql

select meta() from bucket
“cas”: 1512468490617487360,
“expiration”: 0,
“flags”: 0,
“id”: “21”,
“type”: “json”

.Net SDK (not even sure IF you can get the revision metadata from this)

bucket.Get(docId)
“id”:“21”,
“cas”:1512468490617487360,
“token”:“mt{bRef=, vbID= -1, vbUUID=-1, seqno=-1}”,
“content”:“{"_attachments":{"cat.jpg":{"content_type":"image/jpeg","digest":"sha1-oMWAKMWnfn36tgTepCyKfBvcVLA=","length":6546,"revpos":2,"stub":true}},"surveyid":"S3"}”
}

Couchbase Server Web Admin - Documents view

“id”: “21”,
“rev”: “7-14fd5e142d3a00000000000000000000”,
“expiration”: 0,
“flags”: 0

it is also visible via the Sync Gateway REST API and Web Admin interface, but I shouldn’t have to use this with shared bucket access ability available in couchbase, apart from the fact that the rev property is actually Couchbase Server metadata anyway and not Sync Gateway.

I appreciate any assistance or pointers

Did you find how to get this property in the end?

I need it as well for the creation of multiple attachments to a document through a webpage, which required the rev property to be added.

Hey @avia_tm,

The rev property of a document is internal meta-data used for conflict resolution and legacy replication, are you able to describe a bit about your use-case? In many cases, using the revision identifier would be error prone as it is subject to change format and/or semantics between different server versions.

Cheers, Brett

@brett19

My use case is mostly described on another one of my topics:

As it currently stands, there’s no way to direct create multiple attachment through the sync gateway API, therefor I need the revision id for each attachment

Thanks,
Tom

Take a look at Virtual Extended Attributes (VATTRs) which allow you to view various document metadata.