You are currently browsing legacy 3.0 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

Commands: Documents: Put

Put is used to insert or update a document in a database.


PutResult Put(string key, Etag etag, RavenJObject document, RavenJObject metadata);
key string unique key under which document will be stored
etag Etag current document etag, used for concurrency checks (null to skip check)
document RavenJObject document data
metadata RavenJObject document metadata

public class PutResult
	public string Key { get; set; }

	public Etag ETag { get; set; }
Return Value
Key string unique key under which document was stored
Etag Etag stored document etag


		RavenJObject.FromObject(new Category
			Name = "My Category",
			Description = "My Category description"
		new RavenJObject());