使用 RethinkDB 调用 cursor.changes() 时如何获取初始文档

How to get initial documents when calling cursor.changes() with RethinkDB

文档对此明确含糊:

http://rethinkdb.com/docs/changefeeds/javascript/

Point changefeeds will always return initial values and have an initializing state; feeds that return changes on unfiltered tables will never return initial values. Feeds that return changes on more complex queries may or may not return return initial values, depending on the kind of aggregation.

有没有办法通过更改提要强制初始文档?

假设我有一个任意的query。我们可以调用 query.changes.run(//...) 并获取更改提要,但我想确保获取初始文档。至少,我想要一致性!

目前没有您可以放在那里的 optarg,但是在 2.2 版本中,您将能够为此使用 include_initial optarg:https://github.com/rethinkdb/rethinkdb/issues/3579 .