doutun9179 2019-09-06 21:17
浏览 270

mongo-go-driver的clientOptions的默认值是什么?

I was trying to search for default values for clientOptions for mongo-go-driver.

I am trying to initiate new client in following way:

        opts := options.ClientOptions{}
    opts.ApplyURI(connectionURI)
    sharedConnection, err = mongo.NewClient(&opts)

I was wondering what will be the default values for few of the clientOptions like ConnectTimeout, MaxPoolSize, MaxConnIdleTime.

   type ClientOptions struct {
    ConnectTimeout         *time.Duration
    Compressors            []string
    Dialer                 ContextDialer
    HeartbeatInterval      *time.Duration
    LocalThreshold         *time.Duration
    MaxConnIdleTime        *time.Duration
    MaxPoolSize            *uint16
    Monitor                *event.CommandMonitor
    ReadConcern            *readconcern.ReadConcern
    ReadPreference         *readpref.ReadPref
    Registry               *bsoncodec.Registry
    RetryWrites            *bool
    ServerSelectionTimeout *time.Duration
    Direct                 *bool
    SocketTimeout          *time.Duration
    TLSConfig              *tls.Config
    WriteConcern           *writeconcern.WriteConcern
    ZlibLevel              *int
   }
  • 写回答

2条回答 默认 最新

  • duanjing3656 2019-09-06 22:42
    关注

    If there is not flow to set the default value then it will set to Zero Value. Zero Value is when a variable is declared, and not explicitly initialized, it will be allocated storage with a default value

    1. ConnectTimeout --> time.Duration, data type default value = 0s b.
    2. MaxPoolSize --> uint16, data type default value = 0
    3. MaxConnIdleTime --> time.Duration, data type default value = 0s

    another :

    1. bool --> default value is false
    2. string --> default value is ""
    3. int ---> default value is 0
    评论

报告相同问题?

悬赏问题

  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据