diff options
author | Mathias Stearn <mathias@10gen.com> | 2012-07-12 20:43:07 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2012-07-20 16:54:33 -0400 |
commit | 7d1e8a5090569d4d30bd3ec0dfb76e62baf4f304 (patch) | |
tree | a778b364e546c2e809653c37201ca156d34164fc /src/mongo/db/pipeline/document.cpp | |
parent | 2a21b2f2802a78d194a1edce2f7005245e065dc1 (diff) | |
download | mongo-7d1e8a5090569d4d30bd3ec0dfb76e62baf4f304.tar.gz |
Document::toString
Diffstat (limited to 'src/mongo/db/pipeline/document.cpp')
-rwxr-xr-x | src/mongo/db/pipeline/document.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/document.cpp b/src/mongo/db/pipeline/document.cpp index 960e40fcec1..1b856c86476 100755 --- a/src/mongo/db/pipeline/document.cpp +++ b/src/mongo/db/pipeline/document.cpp @@ -56,7 +56,7 @@ namespace mongo { } } - void Document::toBson(BSONObjBuilder *pBuilder) { + void Document::toBson(BSONObjBuilder *pBuilder) const { const size_t n = vFieldName.size(); for(size_t i = 0; i < n; ++i) vpValue[i]->addToBsonObj(pBuilder, vFieldName[i]); @@ -202,6 +202,13 @@ namespace mongo { return 0; } + string Document::toString() const { + // this is a temporary hack and it should only be used for debugging + BSONObjBuilder bb; + toBson(&bb); + return bb.done().toString(); + } + /* ----------------------- FieldIterator ------------------------------- */ FieldIterator::FieldIterator(const intrusive_ptr<Document> &pTheDocument): |