Class MongoClientSettings


  • Deprecated. 
    use MongoClientSettings instead

    @Immutable
    @Deprecated
    public final class MongoClientSettings
    extends java.lang.Object
    Various settings to control the behavior of a MongoClient.
    Since:
    3.0
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MongoClientSettings.Builder
      Deprecated. 
      A builder for MongoClientSettings so that MongoClientSettings can be immutable, and to support easier construction through chaining.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static MongoClientSettings.Builder builder​()
      Deprecated. 
      Convenience method to create a Builder.
      static MongoClientSettings.Builder builder​(MongoClientSettings settings)
      Deprecated. 
      Convenience method to create a from an existing MongoClientSettings.
      java.lang.String getApplicationName​()
      Deprecated. 
      Gets the logical name of the application using this MongoClient.
      com.mongodb.AutoEncryptionSettings getAutoEncryptionSettings​()
      Deprecated. 
      Gets the auto-encryption settings.
      com.mongodb.connection.ClusterSettings getClusterSettings​()
      Deprecated. 
      Gets the cluster settings.
      org.bson.codecs.configuration.CodecRegistry getCodecRegistry​()
      Deprecated. 
      The codec registry to use.
      java.util.List<com.mongodb.event.CommandListener> getCommandListeners​()
      Deprecated. 
      Gets the list of added CommandListener.
      java.util.List<com.mongodb.MongoCompressor> getCompressorList​()
      Deprecated. 
      Gets the compressors to use for compressing messages to the server.
      com.mongodb.connection.ConnectionPoolSettings getConnectionPoolSettings​()
      Deprecated. 
      Gets the settings for the connection provider in a settings object.
      com.mongodb.MongoCredential getCredential​()
      Deprecated. 
      Gets the credential.
      java.util.List<com.mongodb.MongoCredential> getCredentialList​()
      Deprecated. 
      com.mongodb.connection.SocketSettings getHeartbeatSocketSettings​()
      Deprecated. 
      Gets the connection settings for the heartbeat thread (the background task that checks the state of the cluster) wrapped in a settings object.
      com.mongodb.ReadConcern getReadConcern​()
      Deprecated. 
      The read concern to use.
      com.mongodb.ReadPreference getReadPreference​()
      Deprecated. 
      The read preference to use for queries, map-reduce, aggregation, and count.
      boolean getRetryReads​()
      Deprecated. 
      Returns true if reads should be retried if they fail due to a network error or other retryable error.
      boolean getRetryWrites​()
      Deprecated. 
      Returns true if writes should be retried if they fail due to a network error or other retryable error.
      com.mongodb.connection.ServerSettings getServerSettings​()
      Deprecated. 
      Gets the server-specific settings wrapped in a settings object.
      com.mongodb.connection.SocketSettings getSocketSettings​()
      Deprecated. 
      Gets the connection-specific settings wrapped in a settings object.
      com.mongodb.connection.SslSettings getSslSettings​()
      Deprecated. 
      Gets the SSL settings.
      com.mongodb.connection.StreamFactoryFactory getStreamFactoryFactory​()
      Deprecated. 
      Gets the factory to use to create a StreamFactory.
      com.mongodb.WriteConcern getWriteConcern​()
      Deprecated. 
      The write concern to use.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • builder

        public static MongoClientSettings.Builder builder​()
        Deprecated. 
        Convenience method to create a Builder.
        Returns:
        a builder
      • builder

        public static MongoClientSettings.Builder builder​(MongoClientSettings settings)
        Deprecated. 
        Convenience method to create a from an existing MongoClientSettings.
        Parameters:
        settings - create a builder from existing settings
        Returns:
        a builder
      • getReadPreference

        public com.mongodb.ReadPreference getReadPreference​()
        Deprecated. 
        The read preference to use for queries, map-reduce, aggregation, and count.

        Default is ReadPreference.primary().

        Returns:
        the read preference
        See Also:
        ReadPreference.primary()
      • getCredentialList

        @Deprecated
        public java.util.List<com.mongodb.MongoCredential> getCredentialList​()
        Deprecated. Prefer getCredential()
        Gets the credential list.
        Returns:
        the credential list
      • getCredential

        @Nullable
        public com.mongodb.MongoCredential getCredential​()
        Deprecated. 
        Gets the credential.
        Returns:
        the credentia, which may be null
        Since:
        3.6
      • getWriteConcern

        public com.mongodb.WriteConcern getWriteConcern​()
        Deprecated. 
        The write concern to use.

        Default is WriteConcern.ACKNOWLEDGED.

        Returns:
        the write concern
        See Also:
        WriteConcern.ACKNOWLEDGED
      • getRetryWrites

        public boolean getRetryWrites​()
        Deprecated. 
        Returns true if writes should be retried if they fail due to a network error or other retryable error.

        Starting with the 3.11.0 release, the default value is true

        Returns:
        the retryWrites value
        Since:
        3.6
        Since server release
        3.6
      • getRetryReads

        public boolean getRetryReads​()
        Deprecated. 
        Returns true if reads should be retried if they fail due to a network error or other retryable error. The default value is true.
        Returns:
        the retryReads value
        Since:
        3.11
        Since server release
        3.6
      • getReadConcern

        public com.mongodb.ReadConcern getReadConcern​()
        Deprecated. 
        The read concern to use.
        Returns:
        the read concern
        Since:
        3.2
        MongoDB documentation
        Read Concern
        Since server release
        3.2
      • getCodecRegistry

        public org.bson.codecs.configuration.CodecRegistry getCodecRegistry​()
        Deprecated. 
        The codec registry to use. By default, a MongoClient will be able to encode and decode instances of Document.
        Returns:
        the codec registry
        Since:
        3.0
        See Also:
        MongoClient.getDatabase(java.lang.String)
      • getStreamFactoryFactory

        @Nullable
        public com.mongodb.connection.StreamFactoryFactory getStreamFactoryFactory​()
        Deprecated. 
        Gets the factory to use to create a StreamFactory.
        Returns:
        the stream factory factory
        Since:
        3.1
      • getCommandListeners

        public java.util.List<com.mongodb.event.CommandListener> getCommandListeners​()
        Deprecated. 
        Gets the list of added CommandListener. The default is an empty list.
        Returns:
        the unmodifiable list of command listeners
        Since:
        3.3
      • getApplicationName

        @Nullable
        public java.lang.String getApplicationName​()
        Deprecated. 
        Gets the logical name of the application using this MongoClient. The application name may be used by the client to identify the application to the server, for use in server logs, slow query logs, and profile collection.

        Default is null.

        Returns:
        the application name, which may be null
        Since:
        3.4
        Since server release
        3.4
      • getCompressorList

        public java.util.List<com.mongodb.MongoCompressor> getCompressorList​()
        Deprecated. 
        Gets the compressors to use for compressing messages to the server. The driver will use the first compressor in the list that the server is configured to support.

        Default is the empty list.

        Returns:
        the compressors
        Since:
        3.6
        Since server release
        3.4
      • getClusterSettings

        public com.mongodb.connection.ClusterSettings getClusterSettings​()
        Deprecated. 
        Gets the cluster settings.
        Returns:
        the cluster settings
      • getSslSettings

        public com.mongodb.connection.SslSettings getSslSettings​()
        Deprecated. 
        Gets the SSL settings.
        Returns:
        the SSL settings
      • getSocketSettings

        public com.mongodb.connection.SocketSettings getSocketSettings​()
        Deprecated. 
        Gets the connection-specific settings wrapped in a settings object. This settings object uses the values for connectTimeout, socketTimeout and socketKeepAlive.
        Returns:
        a SocketSettings object populated with the connection settings from this MongoClientSettings instance.
        See Also:
        SocketSettings
      • getHeartbeatSocketSettings

        public com.mongodb.connection.SocketSettings getHeartbeatSocketSettings​()
        Deprecated. 
        Gets the connection settings for the heartbeat thread (the background task that checks the state of the cluster) wrapped in a settings object.
        Returns:
        the SocketSettings for the heartbeat thread
        See Also:
        SocketSettings
      • getConnectionPoolSettings

        public com.mongodb.connection.ConnectionPoolSettings getConnectionPoolSettings​()
        Deprecated. 
        Gets the settings for the connection provider in a settings object. This settings object wraps the values for minConnectionPoolSize, maxConnectionPoolSize, maxWaitTime, maxConnectionIdleTime and maxConnectionLifeTime, and uses maxConnectionPoolSize and threadsAllowedToBlockForConnectionMultiplier to calculate maxWaitQueueSize.
        Returns:
        a ConnectionPoolSettings populated with the settings from this MongoClientSettings instance that relate to the connection provider.
        See Also:
        ConnectionPoolSettings
      • getServerSettings

        public com.mongodb.connection.ServerSettings getServerSettings​()
        Deprecated. 
        Gets the server-specific settings wrapped in a settings object. This settings object uses the heartbeatFrequency and minHeartbeatFrequency values from this MongoClientSettings instance.
        Returns:
        a ServerSettings
        See Also:
        ServerSettings
      • getAutoEncryptionSettings

        @Nullable
        public com.mongodb.AutoEncryptionSettings getAutoEncryptionSettings​()
        Deprecated. 
        Gets the auto-encryption settings.

        Client side encryption enables an application to specify what fields in a collection must be encrypted, and the driver automatically encrypts commands and decrypts results.

        Automatic encryption is an enterprise only feature that only applies to operations on a collection. Automatic encryption is not supported for operations on a database or view and will result in error. To bypass automatic encryption, set bypassAutoEncryption=true in ClientSideEncryptionOptions.

        Explicit encryption/decryption and automatic decryption is a community feature, enabled with the new com.mongodb.client.vault .ClientEncryption type. A MongoClient configured with bypassAutoEncryption=true will still automatically decrypt.

        Automatic encryption requires the authenticated user to have the listCollections privilege action.

        Returns:
        the auto-encryption settings, which may be null
        Since:
        3.11