Method: Mongo::Session#session_id
- Defined in:
- lib/mongo/session.rb
#session_id ⇒ BSON::Document
Get the server session id of this session, if the session has not been ended. If the session had been ended, raises Error::SessionEnded.
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/mongo/session.rb', line 255 def session_id if ended? raise Error::SessionEnded end # An explicit session will always have a session_id, because during # construction a server session must be provided. An implicit session # will not have a session_id until materialized, thus calls to # session_id might fail. An application should not have an opportunity # to experience this failure because an implicit session shouldn't be # accessible to applications due to its lifetime being constrained to # operation execution, which is done entirely by the driver. unless materialized? raise Error::SessionNotMaterialized end @server_session.session_id end |