diff options
author | Andreas Nilsson <andreas.nilsson@mongodb.com> | 2016-07-08 10:42:34 -0400 |
---|---|---|
committer | Andreas Nilsson <andreas.nilsson@mongodb.com> | 2016-07-08 10:42:34 -0400 |
commit | 2cd04c5db2c127409388b51829306d129ddb3344 (patch) | |
tree | e6ae8df68c304a991c0c12713704782f4b114604 /src/mongo/bson | |
parent | 79a6ca14abdf9b3f86040f70210122007276e33b (diff) | |
download | mongo-2cd04c5db2c127409388b51829306d129ddb3344.tar.gz |
Revert "SERVER-24840 - Remove unnecessary parameters to BSONObj::toString"
This reverts commit 1d8c2e70a6c62b3a706b9c6657b3e7cc7e491db3.
Diffstat (limited to 'src/mongo/bson')
-rw-r--r-- | src/mongo/bson/bsonelement.cpp | 3 | ||||
-rw-r--r-- | src/mongo/bson/bsonobj.cpp | 6 | ||||
-rw-r--r-- | src/mongo/bson/bsonobj.h | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/bson/bsonelement.cpp b/src/mongo/bson/bsonelement.cpp index cea897f74eb..9c64c21c973 100644 --- a/src/mongo/bson/bsonelement.cpp +++ b/src/mongo/bson/bsonelement.cpp @@ -690,7 +690,8 @@ void BSONElement::toString(StringBuilder& s, bool includeFieldName, bool full, i s << "MinKey"; break; case CodeWScope: - s << "CodeWScope( " << codeWScopeCode() << ", " << codeWScopeObject().toString() << ")"; + s << "CodeWScope( " << codeWScopeCode() << ", " + << codeWScopeObject().toString(false, full) << ")"; break; case Code: if (!full && valuestrsize() > 80) { diff --git a/src/mongo/bson/bsonobj.cpp b/src/mongo/bson/bsonobj.cpp index b57f6bcf88b..30b98e08525 100644 --- a/src/mongo/bson/bsonobj.cpp +++ b/src/mongo/bson/bsonobj.cpp @@ -603,11 +603,11 @@ int BSONObj::nFields() const { return n; } -std::string BSONObj::toString() const { +std::string BSONObj::toString(bool isArray, bool full) const { if (isEmpty()) - return "{}"; + return (isArray ? "[]" : "{}"); StringBuilder s; - toString(s, false, false); + toString(s, isArray, full); return s.str(); } void BSONObj::toString(StringBuilder& s, bool isArray, bool full, int depth) const { diff --git a/src/mongo/bson/bsonobj.h b/src/mongo/bson/bsonobj.h index 2ae4e734279..d7a801eb966 100644 --- a/src/mongo/bson/bsonobj.h +++ b/src/mongo/bson/bsonobj.h @@ -211,7 +211,7 @@ public: */ enum { maxToStringRecursionDepth = 100 }; - std::string toString() const; + std::string toString(bool isArray = false, bool full = false) const; void toString(StringBuilder& s, bool isArray = false, bool full = false, int depth = 0) const; /** Properly formatted JSON string. |