summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bsonobj.h
diff options
context:
space:
mode:
authorIan Boros <ian.boros@mongodb.com>2020-11-02 14:47:03 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-01-19 00:28:40 +0000
commitb110afdd003360552959b58c3e6a8798bc569173 (patch)
treef73ba621fc9c9a15d2cec39d1727cc0eacd8a0f4 /src/mongo/bson/bsonobj.h
parentac96dfc44f04202e70c2026be8f434e13a2a0713 (diff)
downloadmongo-b110afdd003360552959b58c3e6a8798bc569173.tar.gz
SERVER-50754 introduce MakeBSONObjStage and various perf improvements to SBE
Diffstat (limited to 'src/mongo/bson/bsonobj.h')
-rw-r--r--src/mongo/bson/bsonobj.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/bson/bsonobj.h b/src/mongo/bson/bsonobj.h
index 12d2d008546..9dee852bcba 100644
--- a/src/mongo/bson/bsonobj.h
+++ b/src/mongo/bson/bsonobj.h
@@ -129,8 +129,6 @@ public:
// Little endian ordering here, but that is ok regardless as BSON is spec'd to be
// little endian external to the system. (i.e. the rest of the implementation of
// bson, not this part, fails to support big endian)
- static const char kEmptyObjectPrototype[] = {/*size*/ kMinBSONLength, 0, 0, 0, /*eoo*/ 0};
-
_objdata = kEmptyObjectPrototype;
}
@@ -452,6 +450,13 @@ public:
return objsize() <= kMinBSONLength;
}
+ /*
+ * Whether this BSONObj is the "empty prototype" special case.
+ */
+ bool isEmptyPrototype() const {
+ return _objdata == kEmptyObjectPrototype;
+ }
+
/** Alternative output format */
std::string hexDump() const;
@@ -626,6 +631,8 @@ public:
}
private:
+ static constexpr char kEmptyObjectPrototype[] = {/*size*/ kMinBSONLength, 0, 0, 0, /*eoo*/ 0};
+
template <typename Generator>
BSONObj _jsonStringGenerator(const Generator& g,
int pretty,