CouchDb 2.0:update_seq 不是数字

CouchDb 2.0: update_seq is not a number

根据 couchDb 2.0 的官方文档 http://docs.couchdb.org/en/2.0.0/api/database/common.html

获取/{db} 获取有关指定数据库的信息。

参数: db——数据库名称 请求 Headers:

接受 – application/json text/plain

回复Headers:

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

回应JSONObject:

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 Not Found – 未找到请求的数据库

update_seq 必须是 return 作为数字但是当我们 运行 请求

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}

请解释这是 couchdb 2.0 或其他版本中的异常。

CouchDB 文档在这方面不是最新的。 CouchDB 2.0 引入了集群,并且随着集群的出现,update_seq 必须更改为唯一的字符串。

您应该将 update_seq 视为不透明的标识符,而不是具有固有含义的东西。如果 update_seq 已更改,则数据库本身已更改。

也就是说,update_seq的第一部分是一个数字,所以如果你真的需要数字序列,你可以解析它。但我强烈建议不要依赖它,因为 update_seq 格式可能会在未来版本的 CouchDB 中改变。