Documentation ¶
Index ¶
- func NewConnection(host, username, password string, ops ...Option) (*mongo.Client, error)
- type Option
- func WithConnectTimeoutMS(timeout time.Duration) Option
- func WithDirectConnection(direct bool) Option
- func WithHosts(hosts ...string) Option
- func WithMaxIdleTimeMS(idletime time.Duration) Option
- func WithMaxPoolSize(maximum int) Option
- func WithMinPoolSize(minimum int) Option
- func WithPassword(password string) Option
- func WithReplicaSet(replica string) Option
- func WithSocketTimeoutMS(timeout time.Duration) Option
- func WithTLS(enabled bool) Option
- func WithUsername(username string) Option
- func WithWriteConcern(concern string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithConnectTimeoutMS ¶
WithConnectTimeoutMS Specifies the number of milliseconds to wait before timeout on a TCP connection. Default value 30000.
func WithDirectConnection ¶
WithDirectConnection Specifies whether to force dispatch all operations to the host specified in the connection URI. default is false.
func WithMaxIdleTimeMS ¶
WithMaxIdleTimeMS Specifies the maximum amount of time a connection can remain idle in the connection pool before being removed and closed. The default is 0, meaning a connection can remain unused indefinitely.
func WithMaxPoolSize ¶
WithMaxPoolSize Specifies the maximum number of connections that a connection pool may have at a given time. Default value 100.
func WithMinPoolSize ¶
WithMinPoolSize Specifies the minimum number of connections that the driver maintains in a single connection pool. Default value 0.
func WithPassword ¶
WithPassword Specifies user's password.
func WithReplicaSet ¶
WithReplicaSet Specifies the replica set name for the cluster. All nodes in the replica set must have the same replica set name, or the Client will not consider them as part of the set. Default value "null".
func WithSocketTimeoutMS ¶
WithSocketTimeoutMS Specifies the number of milliseconds to wait for a socket read or write to return before returning a network error. The 0 default value indicates that there is no timeout.
func WithTLS ¶
WithTLS Specifies whether to establish a Transport Layer Security (TLS) connection with the instance. This is automatically set to true when using a DNS seedlist (SRV) in the connection string. You can override this behavior by setting the value to false.
func WithUsername ¶
WithUsername Specifies user's username.
func WithWriteConcern ¶
WithWriteConcern Specifies the write concern. For more information on values, see the server documentation on Write Concern opts(https://docs.mongodb.com/manual/reference/write-concern/).