You are currently browsing legacy 3.5 version of documentation. Click here to switch to the newest 5.1 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Changing metadata

The session keeps track of all the files loaded into the session context. If you want to change the file's metadata, you just need to modify it and save changes.


FileHeader file = await session.LoadFileAsync("/movies/intro.avi");

file.Metadata["Copyright"] = "2015 Hibernating Rhinos. All rights reserved."; // modification of existing metadata
file.Metadata.Add("Duration", TimeSpan.FromMinutes(22).ToString()); // adding a new one

await session.SaveChangesAsync();