lib/mongo/server/connection_common.rb
def handshake_document(app_metadata, speculative_auth_doc: nil, load_balancer: false, server_api: nil)
        serv_api = app_metadata.server_api || server_api
        document = if serv_api
                     HELLO_DOC.merge(Utils.transform_server_api(serv_api))
                   else
                     LEGACY_HELLO_DOC
                   end
        document.merge(app_metadata.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
# Build a document that should be used for connection handshake.
#
# @param [ Server::AppMetadata ] app_metadata Application metadata
# @param [ BSON::Document ] speculative_auth_doc The speculative
#   authentication document, if any.
# @param [ true | false ] load_balancer Whether the connection is to
#   a load balancer.
# @param server_api [ Hash | nil ] server_api Server API version.
#
# @return [BSON::Document] Document that should be sent to a server
#     for handshake purposes.
#
# @api private
Build a document that should be used for connection handshake.
Build a document that should be used for connection handshake .
def handshake_document(app_metadata, speculative_auth_doc: nil, load_balancer: false, server_api: nil)
        serv_api = app_metadata.server_api || server_api
        document = if serv_api
                     HELLO_DOC.merge(Utils.transform_server_api(serv_api))
                   else
                     LEGACY_HELLO_DOC
                   end
        document.merge(app_metadata.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
def handshake_document ( app_metadata , speculative_auth_doc : nil , load_balancer : false , server_api : nil ) serv_api = app_metadata . server_api || server_api document = if serv_api HELLO_DOC . merge ( Utils . transform_server_api ( serv_api ) ) else LEGACY_HELLO_DOC end document . merge ( app_metadata . 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
Build a document that should be used for connection handshake.
Build a document that should be used for connection handshake .
Document that should be sent to a server for handshake purposes.
Document that should be sent to a server for handshake purposes .
BSON::Document
app_metadata
speculative_auth_doc
load_balancer
server_api
server_api Server API version.
server_api Server API version .
load_balancer Whether the connection is to a load balancer.
load_balancer Whether the connection is to a load balancer .
api
None