summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/update.h
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2015-02-19 12:04:38 -0500
committerDavid Storch <david.storch@10gen.com>2015-02-19 18:47:44 -0500
commit30d9e17410a3dec85ca2a148c745a6b8f9a8ecd0 (patch)
tree6f563e6d9fc3bee7a74950c8cf2b1cf84a8c526f /src/mongo/db/exec/update.h
parent2b4f184b74703a776b87c08c516a28aa3e7ec28b (diff)
downloadmongo-30d9e17410a3dec85ca2a148c745a6b8f9a8ecd0.tar.gz
SERVER-17303 findAndModify upsert calls Collection::insertDocument() directly
Diffstat (limited to 'src/mongo/db/exec/update.h')
-rw-r--r--src/mongo/db/exec/update.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mongo/db/exec/update.h b/src/mongo/db/exec/update.h
index 3d820dbda6c..fdb07964bf6 100644
--- a/src/mongo/db/exec/update.h
+++ b/src/mongo/db/exec/update.h
@@ -115,6 +115,33 @@ namespace mongo {
*/
static UpdateResult makeUpdateResult(PlanExecutor* exec, OpDebug* opDebug);
+ /**
+ * Computes the document to insert if the upsert flag is set to true and no matching
+ * documents are found in the database. The document to upsert is computing using the
+ * query 'cq' and the update mods contained in 'driver'.
+ *
+ * If 'cq' is NULL, which can happen for the idhack update fast path, then 'query' is
+ * used to compute the doc to insert instead of 'cq'.
+ *
+ * 'doc' is the mutable BSON document which you would like the update driver to use
+ * when computing the document to insert.
+ *
+ * Set 'isInternalRequest' to true if the upsert was issued by the replication or
+ * sharding systems.
+ *
+ * Fills out whether or not this is a fastmodinsert in 'stats'.
+ *
+ * Returns the document to insert in *out.
+ */
+ static Status applyUpdateOpsForInsert(const CanonicalQuery* cq,
+ const BSONObj& query,
+ UpdateDriver* driver,
+ UpdateLifecycle* lifecycle,
+ mutablebson::Document* doc,
+ bool isInternalRequest,
+ UpdateStats* stats,
+ BSONObj* out);
+
private:
/**
* Computes the result of applying mods to the document 'oldObj' at RecordId 'loc' in