开发者

CouchDB: Correlation between update seq and document _id

开发者 https://www.devze.com 2023-03-20 02:56 出处:网络
I\'m trying to use _changes API while dynamically determining the update sequence to start from (_changes?feed=longpoll&since=SEQ). I want to get SEQ number based on the doc._id for let\'s say, al

I'm trying to use _changes API while dynamically determining the update sequence to start from (_changes?feed=longpoll&since=SEQ). I want to get SEQ number based on the doc._id for let's say, all the docs that have field doc.doctype === "data" (I'll be using filters for that). Is this possible? I understand that my problem can be solved using different design documents, but I want to do 开发者_开发技巧this using only one design doc.


There is no correlation between a document's id (or rev) and the database's seq number. The seq number is only relevant to a database on a single machine (think replication).

So, the only place I know of to get a useful seq number is the 'update_seq' returned by GET'ing a database resource's URL:

$ curl http://localhost:5984/scratch
{"db_name":"scratch","doc_count":2,"doc_del_count":0,"update_seq":3,
"purge_seq":0,"compact_running":false,"disk_size":28761,
"instance_start_time":"1310481969310904","disk_format_version":5,
"committed_update_seq":3}
0

精彩评论

暂无评论...
验证码 换一张
取 消