【问题标题】:RavenDB - can you query a specific entity using the etag to get only the changed documents?RavenDB - 您可以使用 etag 查询特定实体以仅获取更改的文档吗?
【发布时间】:2014-09-18 17:05:29
【问题描述】:

在 Raven DB 中,使用 rest api 我可以使用以下方法获取特定集合的所有文档(按实体名称分组的相关文档):

//Get all documents from a collection
http://localhost:8080/databases/{MyDatabase}/indexes/dynamic/{MyEntity}

我可以使用这个获取自给定 etag 以来的所有新/更新文档:

//Get all new/updated documents since a given etag
http://localhost:8080/databases/{MyDatabase}/docs?etag=01000000-0000-0010-0000-000000000001

问题是,上面返回来自所有集合的新/更新文档。

我的问题是,是否可以查询 Ravens rest api 以仅返回自给定 etag 以来已更改的文档,仅针对特定集合?我已经尝试了以下选项,但是对于除 /docs 端点之外的任何 api 调用,etag 参数似乎都被忽略了。

//etag parameter is ignored for these calls
http://localhost:8080/databases/{MyDatabase}/indexes/dynamic/{MyEntity}?etag=01000000-0000-0010-0000-000000000001

http://localhost:8080/databases/{MyDatabase}/indexes/Raven/DocumentsByEntityName?query=Tag:{MyEntity}&etag=01000000-0000-0010-0000-000000000001

【问题讨论】:

    标签: ravendb ravendb-http


    【解决方案1】:

    不,你不能那样使用它。 不过,您可以在对 Raven/DocumentsByEntityName 的查询中使用 LastUpdated 日期。

    【讨论】:

    • 谢谢 - 能够更广泛地使用 Raven 中的 etag 真的很方便。当 etags 被存储和可用时,必须在我们的查询中使用日期来获取更新的文档集,这似乎是一种耻辱。
    猜你喜欢
    • 2014-03-02
    • 2012-07-27
    • 2021-12-04
    • 1970-01-01
    • 1970-01-01
    • 2019-09-17
    • 2016-01-22
    • 2012-12-18
    相关资源
    最近更新 更多