summaryrefslogtreecommitdiff
path: root/src/mongo/db/keypattern.h
diff options
context:
space:
mode:
authorJames Wahlin <james.wahlin@10gen.com>2016-12-19 14:02:02 -0500
committerJames Wahlin <james.wahlin@10gen.com>2016-12-27 16:22:21 -0500
commitac7b0469bdb57a3593dc8b97e5a7045db0efbb24 (patch)
treec759fe0f6c4dff381ac08944f603851db6492c16 /src/mongo/db/keypattern.h
parent72112a72ec3ee48cb883fc02b2904079d11f4954 (diff)
downloadmongo-ac7b0469bdb57a3593dc8b97e5a7045db0efbb24.tar.gz
SERVER-27175 Improve performance of planSummary string generation
Diffstat (limited to 'src/mongo/db/keypattern.h')
-rw-r--r--src/mongo/db/keypattern.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/keypattern.h b/src/mongo/db/keypattern.h
index f9ac83983e3..cfa24da5df2 100644
--- a/src/mongo/db/keypattern.h
+++ b/src/mongo/db/keypattern.h
@@ -29,7 +29,9 @@
#pragma once
#include "mongo/base/string_data.h"
+#include "mongo/bson/util/builder.h"
#include "mongo/db/jsobj.h"
+#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -80,9 +82,13 @@ public:
* Returns a string representation of this KeyPattern
*/
std::string toString() const {
- return toBSON().toString();
+ return str::stream() << *this;
}
+ /**
+ * Writes to 'sb' a string representation of this KeyPattern.
+ */
+ friend StringBuilder& operator<<(StringBuilder& sb, const KeyPattern& keyPattern);
/* Takes a BSONObj whose field names are a prefix of the fields in this keyPattern, and
* outputs a new bound with MinKey values appended to match the fields in this keyPattern