根据couchDb 2.0的官方文件 http://docs.couchdb.org/en/2.0.0/api/database/common.html
获取/ {db} 获取有关指定数据库的信息。
参数: db - 数据库名称 请求标题:
接受 - 应用程序/ JSON 文本/纯
响应标题:
Content-Type –
application/json
text/plain; charset=utf-8
响应JSON对象:
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.**
状态代码:
200 OK - 请求已成功完成
找不到404 - 找不到请求的数据库
update_seq必须以数字形式返回,但在我们运行请求时
http://192.168.1.48:5984/testing **(CouchDb 2.0)**回复是
{"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"}
以前在我们运行请求的couchdb 1.6.1中
http://192.168.1.80:5984/learners (CouchDb 2.0)响应
{"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}
因此,plz解释这是在couchdb 2.0或其他方面的一个例外。
答案 0 :(得分:3)
CouchDB文档不是最新版本。 CouchDB 2.0引入了群集,并且通过群集,update_seq必须更改为唯一的字符串。
您应该将update_seq视为不透明的标识符,而不是具有固有含义的内容。如果update_seq已更改,则数据库本身已更改。
也就是说,update_seq的第一部分是一个数字,所以如果你真的需要数字序列,你可以解析它。但我强烈建议不要依赖它,因为update_seq格式可能会在未来版本的CouchDB中发生变化。