summaryrefslogtreecommitdiff
path: root/src/mongo/db/field_parser.h
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2017-06-07 08:14:06 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2017-06-07 08:14:06 -0400
commit386a788bd9f565c1a4bba46b5b570f7e53e85c7b (patch)
tree13d85a5611f023a7cfefef9b169bf2f5ac1127ae /src/mongo/db/field_parser.h
parent06369c8cedbb06a554012069c8973423b32d9452 (diff)
downloadmongo-386a788bd9f565c1a4bba46b5b570f7e53e85c7b.tar.gz
Revert "SERVER-29464 Get rid of BSONSerializable"
This reverts commit 06369c8cedbb06a554012069c8973423b32d9452.
Diffstat (limited to 'src/mongo/db/field_parser.h')
-rw-r--r--src/mongo/db/field_parser.h47
1 files changed, 30 insertions, 17 deletions
diff --git a/src/mongo/db/field_parser.h b/src/mongo/db/field_parser.h
index 20840c57f2a..376bd66f561 100644
--- a/src/mongo/db/field_parser.h
+++ b/src/mongo/db/field_parser.h
@@ -216,9 +216,12 @@ public:
// TODO: BSONElement extraction of types below
/**
- * Extracts a mandatory 'field' from the object 'doc'. Writes the extracted contents to '*out'
- * if successful or fills '*errMsg', if exising, otherwise. This variant relies on T having a
- * parseBSON method.
+ * Extracts a mandatory BSONSerializable structure 'field' from the object 'doc'. Write
+ * the extracted contents to '*out' if successful or fills '*errMsg', if exising,
+ * otherwise. This variant relies on T having a parseBSON, which all
+ * BSONSerializable's have.
+ *
+ * TODO: Tighten for BSONSerializable's only
*/
template <typename T>
static FieldState extract(BSONObj doc,
@@ -226,17 +229,19 @@ public:
T* out,
std::string* errMsg = NULL);
- /**
- * Similar to the mandatory 'extract' but on a optional field. The '*out' value would only be
- * allocated if the field is present. The ownership of '*out' would be transferred to the
- * caller, in that case.
- */
template <typename T>
static FieldState extract(BSONObj doc,
const BSONField<T*>& field,
T** out,
std::string* errMsg = NULL);
+ /**
+ * Similar to the mandatory 'extract' but on a optional field. '*out' would only be
+ * allocated if the field is present. The ownership of '*out' would be transferred to
+ * the caller, in that case.
+ *
+ * TODO: Tighten for BSONSerializable's only
+ */
template <typename T>
static FieldState extract(BSONObj doc,
const BSONField<T>& field,
@@ -244,11 +249,14 @@ public:
std::string* errMsg = NULL);
/**
- * Extracts a mandatory repetition of 'field', from the object 'doc'. Writes the extracted
- * contents to '*out' if successful or fills '*errMsg', if exising, otherwise. This variant
- * relies on T having a parseBSON method.
+ * Extracts a mandatory repetition of BSONSerializable structures, 'field', from the
+ * object 'doc'. Write the extracted contents to '*out' if successful or fills
+ * '*errMsg', if exising, otherwise. This variant relies on T having a parseBSON,
+ * which all BSONSerializable's have.
*
* The vector owns the instances of T.
+ *
+ * TODO: Tighten for BSONSerializable's only
*/
template <typename T>
static FieldState extract(BSONObj doc,
@@ -257,11 +265,14 @@ public:
std::string* errMsg = NULL);
/**
- * Extracts a mandatory repetition of 'field', from the field 'elem'. Writes the extracted
- * contents to '*out' if successful or fills '*errMsg', if exising, otherwise. This variant
- * relies on T having a parseBSON method.
+ * Extracts a mandatory repetition of BSONSerializable structures, 'field', from the
+ * field 'elem'. Write the extracted contents to '*out' if successful or fills
+ * '*errMsg', if exising, otherwise. This variant relies on T having a parseBSON,
+ * which all BSONSerializable's have.
*
* The vector owns the instances of T.
+ *
+ * TODO: Tighten for BSONSerializable's only
*/
template <typename T>
static FieldState extract(BSONElement elem,
@@ -270,11 +281,13 @@ public:
std::string* errMsg = NULL);
/**
- * Similar to the mandatory repetition' extract but on an optional field. The '*out' value would
- * only be allocated if the field is present. The ownership of '*out' would be transferred to
- * the caller, in that case.
+ * Similar to the mandatory repetition' extract but on an optional field. '*out' would
+ * only be allocated if the field is present. The ownership of '*out' would be
+ * transferred to the caller, in that case.
*
* The vector owns the instances of T.
+ *
+ * TODO: Tighten for BSONSerializable's only
*/
template <typename T>
static FieldState extract(BSONObj doc,