使用 Pouchdb 更改提要如何从第一个更改开始

using Pouchdb change feed how to start from first change

我正在监听一个只有写入的数据库。 为此,我使用以下代码:

db.changes({
 since: 'now',
 live: true,
 include_docs: true
}).on('change', function (change) {
   // change.id contains the doc id, change.doc contains the doc
}).on('error', function (err) {
// handle errors
});

因为:'now' 从现在开始收听更改,我想从第一个文档开始收听,当我赶上来时我想收听实时更改。

有什么方法可以从第一次更改数据库开始,然后进行实时更改?

谢谢

不要使用"since"选项,它将始终从数据库的第一个更改顺序开始。然后它将为数据库中发生的每个更改调用 "change" 处理程序,并且还将为所有未来更改调用 "change" 处理程序。我 not 在 CouchDB 2.0 上对此进行了测试,它确实使用了不同的序列号格式 ("strings, not numbers, as it encodes the numeric sequences of each shard of the database"),但我希望省略 since 选项将以相同的方式工作。