ravendbravendb-http

RavenDB - can you query a specific entity using the etag to get only the changed documents?


In Raven DB, using the rest api I can get all documents of a particular collection (related documents grouped by entity name) using this:

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

I can get all new / updated documents since a given etag using this:

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

The problem is, the above returns new / updated documents from all collections.

My question is, is it possible to query Ravens rest api to return only documents that have changed since a given etag, for a specific collection only? I have tried the options below however the etag parameter seems to get ignored for any api calls except the /docs endpoint.

//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

Solution

  • No, you cannot use this like that. You can use the LastUpdated date in a query to Raven/DocumentsByEntityName, though.