diff --git a/mongo/session.go b/mongo/session.go index 97d17736af..8ba400c084 100644 --- a/mongo/session.go +++ b/mongo/session.go @@ -122,6 +122,10 @@ type Session interface { // OperationTime returns the current operation time document associated with the session. OperationTime() *primitive.Timestamp + // SnapshotTime returns the snapshot timestamp being used for the session. + // If the session is not a snapshot session, or no operations have run on the session yet, it will return nil. + SnapshotTime() *primitive.Timestamp + // Client the Client associated with the session. Client() *Client @@ -361,6 +365,11 @@ func (s *sessionImpl) OperationTime() *primitive.Timestamp { return s.clientSession.OperationTime } +// SnapshotTime implements the Session interface. +func (s *sessionImpl) SnapshotTime() *primitive.Timestamp { + return s.clientSession.SnapshotTime +} + // AdvanceOperationTime implements the Session interface. func (s *sessionImpl) AdvanceOperationTime(ts *primitive.Timestamp) error { return s.clientSession.AdvanceOperationTime(ts)