Question

In the Raven Studio UI, when you look into a document you can read (on the right of the page) the last write date of the document.

I don't find any access via the client API in C# to this information. Do you know if it's possible ?

Was it helpful?

Solution

The last modifed date is stored in the metadata of the document. You can access it like this:

var product = session.Load<Product>(1);
RavenJObject metadata = session.Advanced.GetMetadataFor(product);

// Get the last modified time stamp, which is known to be of type DateTime
DateTime lastModified = metadata.Value<DateTime>("Last-Modified");

See Working with document metadata for more information about RavenDB's metadata.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top