Method: Mongo::Client#get_session
- Defined in:
- lib/mongo/client.rb
#get_session(options = {}) ⇒ Session | nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a session to use for operations if possible.
If :session option is set, validates that session and returns it. Otherwise, if deployment supports sessions, creates a new session and returns it. When a new session is created, the session will be implicit (lifecycle is managed by the driver) if the :implicit option is given, otherwise the session will be explicit (lifecycle managed by the application). If deployment does not support session, returns nil.
1118 1119 1120 1121 1122 |
# File 'lib/mongo/client.rb', line 1118 def get_session( = {}) get_session!() rescue Error::SessionsNotSupported nil end |