diff options
Diffstat (limited to 'src/mongo/db/repl/optime.cpp')
-rw-r--r-- | src/mongo/db/repl/optime.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/repl/optime.cpp b/src/mongo/db/repl/optime.cpp index 92a3c5556ca..53474c9ba60 100644 --- a/src/mongo/db/repl/optime.cpp +++ b/src/mongo/db/repl/optime.cpp @@ -82,6 +82,13 @@ StatusWith<OpTime> OpTime::parseFromOplogEntry(const BSONObj& obj) { return OpTime(ts, term); } +BSONObj OpTime::toBSON() const { + BSONObjBuilder bldr; + bldr.append(kTimestampFieldName, _timestamp); + bldr.append(kTermFieldName, _term); + return bldr.obj(); +} + std::string OpTime::toString() const { std::stringstream ss; ss << "(term: " << _term << ", timestamp: " << _timestamp.toStringPretty() << ")"; |