9

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 ?

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
Antoine Blanchet
  • 325
  • 2
  • 17

1 Answers1

10

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.

loraderon
  • 4,658
  • 2
  • 32
  • 35
Thomas Freudenberg
  • 5,048
  • 1
  • 35
  • 44