1

According to official doc of couchDb 2.0 http://docs.couchdb.org/en/2.0.0/api/database/common.html

GET /{db} Gets information about the specified database.

Parameters: db – Database name Request Headers:

Accept – application/json text/plain

Response Headers:

Content-Type –
application/json
text/plain; charset=utf-8

Response JSON Object:

committed_update_seq (number) – The number of committed update.
compact_running (boolean) – Set to true if the database compaction routine is operating on this database.
db_name (string) – The name of the database.
disk_format_version (number) – The version of the physical format used for the data when it is stored on disk.
data_size (number) – The number of bytes of live data inside the database file.
disk_size (number) – The length of the database file on disk. Views indexes are not included in the calculation.
doc_count (number) – A count of the documents in the specified database.
doc_del_count (number) – Number of deleted documents
instance_start_time (string) – Timestamp of when the database was opened, expressed in microseconds since the epoch.
purge_seq (number) – The number of purge operations on the database.
**update_seq (number) – The current number of updates to the database.**

Status Codes:
200 OK – Request completed successfully 404 Not Found – Requested database not found

The update_seq must be return as number but when we run the request

http://192.168.1.48:5984/testing **(CouchDb 2.0)**the response is

{"db_name":"testing","update_seq":"0-g1AAAAFTeJzLYWBg4MhgTmEQTM4vTc5ISXLIyU9OzMnILy7JAUoxJTIkyf___z8rkQGPoiQFIJlkT1idA0hdPGF1CSB19QTV5bEASYYGIAVUOp8YtQsgavcTo_YARO19YtQ-gKgFuTcLANRjby4","sizes":{"file":33952,"external":0,"active":0},"purge_seq":0,"other":{"data_size":0},"doc_del_count":0,"doc_count":0,"disk_size":33952,"disk_format_version":6,"data_size":0,"compact_running":false,"instance_start_time":"0"}

previously in couchdb 1.6.1 when we run the request

http://192.168.1.80:5984/learners (CouchDb 2.0) the response is

{"db_name":"learners","doc_count":0,"doc_del_count":3,**"update_seq":6**,"purge_seq":0,"compact_running":false,"disk_size":12386,"data_size":657,"instance_start_time":"1487830025605920","disk_format_version":6,"committed_update_seq":6}

So plz explain is this a exception in couchdb 2.0 or something else.

Piyush Srivastava
  • 357
  • 1
  • 4
  • 21

1 Answers1

3

The CouchDB docs are not up to date on this one. CouchDB 2.0 introduced clustering, and with the clustering the update_seq had to be change to a unique string.

You should treat the update_seq as an opaque identifier, not as something with an inherent meaning. If the update_seq has changed, the database itself has changed.

That said, the first part of the update_seq is a number, so if you really need the numeric sequence, you can parse it. But I would strongly advise to not rely on it, because the update_seq format might change in a future version of CouchDB.

Bernhard Gschwantner
  • 1,547
  • 11
  • 12