pub(crate) fn build_client_first(
    credential: &Credential,
    server_api: Option<&ServerApi>,
) -> Command {
    let mut auth_command_doc = doc! {
        "authenticate": 1,
        "mechanism": "MONGODB-X509",
    };

    if let Some(ref username) = credential.username {
        auth_command_doc.insert("username", username);
    }

    let mut command = Command::new("authenticate".into(), "$external".into(), auth_command_doc);
    if let Some(server_api) = server_api {
        command.set_server_api(server_api);
    }

    command
}
/// Constructs the first client message in the X.509 handshake.
Constructs the first client message in the X.509 handshake.
Constructs the first client message in the X . 509 handshake .
pub(crate) fn build_client_first(
    credential: &Credential,
    server_api: Option<&ServerApi>,
) -> Command {
    let mut auth_command_doc = doc! {
        "authenticate": 1,
        "mechanism": "MONGODB-X509",
    };
    if let Some(ref username) = credential.username {
        auth_command_doc.insert("username", username);
    }
    let mut command = Command::new("authenticate".into(), "$external".into(), auth_command_doc);
    if let Some(server_api) = server_api {
        command.set_server_api(server_api);
    }
    command
}
pub ( crate ) fn build_client_first ( credential : & Credential , server_api : Option < & ServerApi > , ) -> Command { let mut auth_command_doc = doc ! { " " 1 " " " " } ; if let Some ( ref username ) = credential . username { auth_command_doc . insert ( " " , username ) ; } let mut command = Command :: new ( " " . into ( ) , " " . into ( ) , auth_command_doc ) ; if let Some ( server_api ) = server_api { command . set_server_api ( server_api ) ; } command }
Constructs the first client message in the X.509 handshake.
Constructs the first client message in the X . 509 handshake .
credential
&Credential
server_api
Option<&ServerApi>
credential
&Credential
server_api
Option<&ServerApi>