문서 메뉴
문서 홈
/ / /
Rust 드라이버
/ /

연결 옵션

이 가이드에서는 MongoDB 연결 및 인증 옵션에 대해 알아볼 수 있습니다. 연결 문자열의 매개변수로 연결 옵션을 설정하여 Client 인스턴스가 서버에 연결된 동안 작동하는 방식을 지정할 수 있습니다.

옵션 이름
허용되는 값
기본값
설명
앱 이름
문자열
none
Specifies the application name that the Client instance sends to the server as part of the handshake.
Specifying an appName can help you use the server logs to determine which Client instance is connected to the server.
authMechanism
문자열
none
사용할 인증 메커니즘을 지정합니다. 이 옵션을 지정하지 않으면 드라이버는 기본 인증 메커니즘을 사용합니다. Rust 드라이버의 인증에 대해 자세히 알아보려면 인증 메커니즘 가이드를 참조하세요.
authMechanismProperties
문자열
none
authMechanism 옵션에 설정된 인증 메커니즘에 대한 추가 속성을 지정합니다.
authSource
문자열
설명 참조
Specifies the database used to authenticate.
This option defaults to admin for SCRAM-based authentication mechanisms, $external for the MONGODB-X509 mechanism, and the database name or $external for the PLAIN mechanism.
압축기
쉼표로 구분된 문자열 목록
none
Client 인스턴스가 지정된 순서대로 사용하는 압축기를 지정합니다. 네트워크 압축에 대해 자세히 알아보려면 네트워크 압축 가이드를 참조하세요.
connectTimeoutMS
음수가 아닌 정수
10000 (10초)
서버에 연결을 시도할 때 각 기본 TCP 스트림에 전달되는 연결 제한 시간(밀리초)을 지정합니다.
directConnection
부울
false
cluster의 모든 서버를 검색하여 연결하는 대신 Client 인스턴스를 단일 호스트에 직접 연결할지 여부를 지정합니다.
heartbeatFrequencyMS
500보다 크거나 이와 동일한 정수
10000 (10초)
각 모니터링 스레드가 서버 검사를 수행하는 사이에 대기하는 시간(밀리초)을 지정합니다.
일지
부울
false
작업이 온디스크 저널로 전파되었음을 확인 요청합니다.
localThresholdMS
음수가 아닌 정수
15
Specifies the amount of time in milliseconds that the average round-trip time between the driver and server can last compared to the shortest round-trip time of all the suitable servers.
A value of 0 indicates that there is no latency window, so only the server with the lowest average round-trip time is eligible.
maxIdleTimeMS
음수가 아닌 정수
0
Specifies the amount of time in milliseconds that a connection can remain idle in a connection pool the server closes it.
A value of 0 indicates that the client does not close idle connections.
최대 보관 기간
-1, 또는 다음보다 크거나 같은 정수 90
-1
Specifies the maximum lag, in seconds, behind the primary node that a secondary node can be to be considered for the given operation.
The value of this option must be at least 90, or the operation raises an error. A value of -1 means there is no maximum lag.
maxPoolSize
음수가 아닌 정수
10
Specifies the maximum number of connections that the Client instance can create in a connection pool for a given server.
If you attempt an operation while the value of maxPoolSize connections are checked out, the operation waits until an in-progress operation finishes and the connection returns to the pool.
minPoolSize
음수가 아닌 정수
0
Specifies the minimum number of connections that are available in a server's connection pool at a given time.
If fewer than minPoolSize connections are in the pool, the server adds connections in the background up to the value of minPoolSize.
readConcernLevel
문자열
none
Client 인스턴스에서 수행되는 작업에 대한 기본 읽기 고려를 지정합니다. 자세한 내용은 MongoDB Server 매뉴얼의 읽기 고려 사항 을 참조하세요.
읽기 설정
문자열
primary
드라이버가 읽기 작업을 복제본 세트의 멤버로 라우팅하는 방법을 지정합니다. 자세한 내용은 MongoDB Server 매뉴얼의 읽기 설정 을 참조하세요.
readPreferenceTags
쉼표로 구분된 키-값 쌍 목록
none
작업에 고려되는 복제본 세트 멤버를 지정합니다. 이 키의 각 인스턴스는 별도의 태그 세트입니다. 드라이버는 세트에서 각 태그가 있는 하나 이상의 서버를 찾을 때까지 각 태그 세트를 확인합니다.
복제본 세트
문자열
none
Client 인스턴스가 연결되는 복제본 세트의 이름을 지정합니다.
retryReads
부울
true
작업이 실패할 경우 클라이언트가 읽기 작업을 다시 시도할지 여부를 지정합니다.
serverSelectionTimeoutMS
음수가 아닌 정수
30000 (30초)
Client 인스턴스가 시간 초과되기 전에 작업에 대한 서버를 선택하려고 할 때 대기하는 시간(밀리초)을 지정합니다.
TLS
부울
false
서버와의 연결에 사용할 Client 인스턴스에 대한 TLS 구성을 지정합니다. 기본적으로 TLS는 꺼져 있습니다.
tlsAllowInvalidCertificates
부울
false
Specifies whether the Client instance returns an error if the server presents an invalid certificate.
We recommend that you set this option to true only in testing environments to avoid creating vulnerabilities in your application.
tlsCAFile
문자열
설명 참조
Specifies the path to the certificate authority (CA) file that the Client instance uses for TLS.
If you do not specify this option, the driver uses the Mozilla root certificates from the webpki-roots crate.
tlsCertificateKeyFile
문자열
none
Specifies the path to the certificate file that the Client instance presents to the server to verify its identify.
If you do not set this option, the Client instance does not attempt to verify its identity to the server.
tlsInsecure
부울
false
Specifies whether the Client instance returns an error if the server presents an invalid certificate.
We recommend that you set this option to true only in testing environments to avoid creating vulnerabilities in your application.
w
음수가 아닌 정수 또는 문자열
none
Requests acknowledgment that the operation has propagated to a specific number or variety of servers.
To learn more, see Write Concern in the Server manual.
wTimeoutMS
음수가 아닌 정수
시간 초과 없음
쓰기 고려 (write concern)의 제한 시간(밀리초)을 지정합니다. 작업이 제한 시간 내에 요청된 수준으로 전파되지 않으면 드라이버에서 오류가 발생합니다.
zlibCompressionLevel
-1과 9 사이의 정수(포함)
-1
Specifies the level field of the zlib compression if you use that compressor.
Setting a value of -1 selects the default compression level (6).
Setting a value of 0 specifies no compression, and setting a value of 9 specifies maximum compression.
To learn more about network compression, see the Network Compression guide.

연결 옵션의 전체 목록을 보려면 연결 문자열에 대한 MongoDB Server 매뉴얼 항목의 연결 string 옵션 섹션 을 방문하세요.

돌아가기

연결 가이드