summaryrefslogtreecommitdiff
path: root/src/mongo/db/field_ref_set.h
diff options
context:
space:
mode:
authorBernard Gorman <bernard.gorman@mongodb.com>2019-11-14 21:59:35 +0000
committerevergreen <evergreen@mongodb.com>2019-11-14 21:59:35 +0000
commit23e55cb3d041236f399f7095df31cd3e3da491cc (patch)
tree25bc309af51bc66dbd46922b0cf7560b3351478a /src/mongo/db/field_ref_set.h
parentcdc44d95e169da75093f25c324aa9670e72743e8 (diff)
downloadmongo-23e55cb3d041236f399f7095df31cd3e3da491cc.tar.gz
SERVER-43860 Always upsert exact source document for pipeline-insert $merge
Diffstat (limited to 'src/mongo/db/field_ref_set.h')
-rw-r--r--src/mongo/db/field_ref_set.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/mongo/db/field_ref_set.h b/src/mongo/db/field_ref_set.h
index 63166acbc89..0019bf9b4ba 100644
--- a/src/mongo/db/field_ref_set.h
+++ b/src/mongo/db/field_ref_set.h
@@ -64,6 +64,8 @@ public:
FieldRefSet();
+ FieldRefSet(const std::vector<std::unique_ptr<FieldRef>>& paths);
+ FieldRefSet(const std::vector<const FieldRef*>& paths);
FieldRefSet(const std::vector<FieldRef*>& paths);
/** Returns 'true' if the set is empty */
@@ -89,9 +91,9 @@ public:
}
/**
- * Returns true if the field 'toInsert' can be added in the set without
- * conflicts. Otherwise returns false and fill in '*conflict' with the field 'toInsert'
- * clashed with.
+ * Returns true if the field 'toInsert' was added to the set without conflicts.
+ *
+ * Otherwise, returns false and fills '*conflict' with the field 'toInsert' clashed with.
*
* There is no ownership transfer of 'toInsert'. The caller is responsible for
* maintaining it alive for as long as the FieldRefSet is so. By the same token
@@ -100,13 +102,25 @@ public:
bool insert(const FieldRef* toInsert, const FieldRef** conflict);
/**
- * Fills the set with the supplied FieldRef*s
+ * Returns true if the field 'toInsert' was added to the set without conflicts.
+ */
+ bool insertNoConflict(const FieldRef* toInsert);
+
+ /**
+ * Fills the set with the supplied FieldRef pointers.
*
* Note that *no* conflict resolution occurs here.
*/
void fillFrom(const std::vector<FieldRef*>& fields);
/**
+ * Fills the set with the supplied FieldRefs. Does not take ownership of the managed pointers.
+ *
+ * Note that *no* conflict resolution occurs here.
+ */
+ void fillFrom(const std::vector<std::unique_ptr<FieldRef>>& fields);
+
+ /**
* Replace any existing conflicting FieldRef with the shortest (closest to root) one.
*/
void keepShortest(const FieldRef* toInsert);