public void Update(Document doc)
{
//Try to generate a selector using _id for an existing document.
//otherwise just set the upsert flag to 1 to insert and send onward.
Document selector = new Document();
int upsert = 0;
if(doc.Contains("_id") & doc["_id"] != null){
selector["_id"] = doc["_id"];
}else{
//Likely a new document
doc.Prepend("_id",oidGenerator.Generate());
upsert = 1;
}
this.Update(doc, selector, upsert);
}
Collection::Update ( |
|
Collection::Update ( |
|
Collection::Update ( |
|
Collection::Update ( |
|
Collection::Update ( |
|
Collection::Update ( |
|
Collection::Update ( |