How do I retrieve de revision identifier from a Couchbase document with SG?


#1

Hi, I need to retrieve the revision identifier in a Couchbase document via Sync Gateaway for bulk update and delete. Can anyone help me with this please?


#2

@egroj97,

  Do you need parent revision so that you can update and delete the doc by giving parent revision?
  If that is the case, before you update, you can get current revision of the docs from _all_docs API. 

curl -X GET “http://localhost:4984/db/_all_docs?channels=true&include_docs=true&revs=true” -H “accept: application/json”

If you need for single document : you can use this
curl -X GET “http://localhost:4984/db/doc_1?revs=true” -H “accept: application/json”
where doc_1 is the your document id .

If you want to check revision history :
curl -X GET “http://localhost:4984/db/doc_1?open_revs=all&revs=true” -H “accept: application/json”
where doc_1 is the your document id .


#3

Thank you very much, I really needed this.