summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bsonelement.h
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2015-04-06 09:10:57 -0400
committerEric Milkie <milkie@10gen.com>2015-04-07 16:25:34 -0400
commit0f58d1037bcbfbf932e73e623772c4f815c361ad (patch)
treeae7ea2cf29830f0dc39e326142ddc1b6bc468804 /src/mongo/bson/bsonelement.h
parent72543912dca4117e1deb45a56c599657a1bf747c (diff)
downloadmongo-0f58d1037bcbfbf932e73e623772c4f815c361ad.tar.gz
SERVER-17880 Rename OpTime to Timestamp
Diffstat (limited to 'src/mongo/bson/bsonelement.h')
-rw-r--r--src/mongo/bson/bsonelement.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h
index b79cc19d0cd..cc5c687f8d7 100644
--- a/src/mongo/bson/bsonelement.h
+++ b/src/mongo/bson/bsonelement.h
@@ -37,13 +37,14 @@
#include "mongo/base/data_view.h"
#include "mongo/bson/bsontypes.h"
#include "mongo/bson/oid.h"
+#include "mongo/bson/timestamp.h"
#include "mongo/platform/cstdint.h"
namespace mongo {
- class OpTime;
class BSONObj;
class BSONElement;
class BSONObjBuilder;
+ class Timestamp;
typedef BSONElement be;
typedef BSONObj bo;
@@ -452,6 +453,12 @@ namespace mongo {
}
}
+ Timestamp timestamp() const {
+ if( type() == mongo::Date || type() == bsonTimestamp )
+ return Timestamp(ConstDataView(value()).readLE<unsigned long long>());
+ return Timestamp();
+ }
+
Date_t timestampTime() const {
unsigned long long t = ConstDataView(value() + 4).readLE<unsigned int>();
return t * 1000;
@@ -524,7 +531,6 @@ namespace mongo {
}
std::string _asCode() const;
- OpTime _opTime() const;
template<typename T> bool coerce( T* out ) const;