Commands: Documents: Put
Put is used to insert or update a document in a database.
Syntax
PutResult Put(string key, Etag etag, RavenJObject document, RavenJObject metadata);
Parameters |
|
|
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 |
Example
store
.DatabaseCommands
.Put(
"categories/999",
null,
RavenJObject.FromObject(new Category
{
Name = "My Category",
Description = "My Category description"
}),
new RavenJObject());