Method: Mongo::Server::ConnectionCommon#handshake_document
- Defined in:
- lib/mongo/server/connection_common.rb
#handshake_document(app_metadata, speculative_auth_doc: nil, load_balancer: false, server_api: nil) ⇒ BSON::Document
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.
Build a document that should be used for connection handshake.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/mongo/server/connection_common.rb', line 68 def handshake_document(, speculative_auth_doc: nil, load_balancer: false, server_api: nil) serv_api = .server_api || server_api document = if serv_api HELLO_DOC.merge(Utils.transform_server_api(serv_api)) else LEGACY_HELLO_DOC end document.merge(.validated_document).tap do |doc| if speculative_auth_doc doc.update(speculativeAuthenticate: speculative_auth_doc) end if load_balancer doc.update(loadBalanced: true) end end end |