summaryrefslogtreecommitdiff
path: root/src/mongo/db/field_parser.h
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2015-01-12 08:35:02 -0500
committerEliot Horowitz <eliot@10gen.com>2015-01-12 08:35:14 -0500
commitd0802b350f70999f2d9e8d3b718f2cbed3163a31 (patch)
tree303690db1f8697c6121664209f959274df51e240 /src/mongo/db/field_parser.h
parentf044f77243692cedebc1ee01ae8ae0a2470de6b0 (diff)
downloadmongo-d0802b350f70999f2d9e8d3b718f2cbed3163a31.tar.gz
optimize update request parsing
Diffstat (limited to 'src/mongo/db/field_parser.h')
-rw-r--r--src/mongo/db/field_parser.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/field_parser.h b/src/mongo/db/field_parser.h
index bd6d852e71f..92a3df37e39 100644
--- a/src/mongo/db/field_parser.h
+++ b/src/mongo/db/field_parser.h
@@ -267,6 +267,22 @@ namespace mongo {
std::string* errMsg = NULL);
/**
+ * 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,
+ const BSONField<std::vector<T*> >& field,
+ std::vector<T*>* out,
+ std::string* errMsg = NULL);
+
+ /**
* 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.