Database Settings Operations


Do not modify the database settings unless you are an expert and know what you're doing.

Put database settings operation

  • Use PutDatabaseSettingsOperation to modify the default database configuration.

  • Only database-level settings can be customized using this operation.
    See article Configuration overview to learn how to customize the server-level settings.

  • Note: for the changes to take effect, the database must be reloaded.
    Reloading is accomplished by disabling and enabling the database using ToggleDatabasesStateOperation.
    See the following example:

// 1. Modify the database settings:
// ================================

// Define a settings object with key-value pairs to set, for example:
const settings = {
    "Databases.QueryTimeoutInSec": "350",
    "Indexing.Static.DeploymentMode": "Rolling"
};

// Define the put database settings operation,
// specify the database name & pass the settings dictionary
const putDatabaseSettingsOp = new PutDatabaseSettingsOperation(documentStore.database, settings)

// Execute the operation by passing it to maintenance.send
await documentStore.maintenance.send(putDatabaseSettingsOp);

// 2. RELOAD the database for the change to take effect:
// =====================================================

// Disable database
const disableDatabaseOp = new ToggleDatabasesStateOperation(documentStore.database, true);
await documentStore.maintenance.server.send(disableDatabaseOp);

// Enable database
const enableDatabaseOp = new ToggleDatabasesStateOperation(documentStore.database, false);
await documentStore.maintenance.server.send(enableDatabaseOp);

Syntax:

const putDatabaseSettingsOp = new PutDatabaseSettingsOperation(databaseName, configurationSettings)
Parameter Type Description
databaseName string Name of database for which to change the settings.
configurationSettings object The configuration settings to set.

Get database settings operation

  • Use GetDatabaseSettingsOperation to get the configuration settings that were customized for the database.

  • Only settings that have been changed will be retrieved.

// Define the get database settings operation, specify the database name
const getDatabaseSettingsOp = new GetDatabaseSettingsOperation(documentStore.database);

// Execute the operation by passing it to maintenance.send
const customizedSettings = await documentStore.maintenance.send(getDatabaseSettingsOp);

// Get the customized value
const customizedValue = customizedSettings.settings["Databases.QueryTimeoutInSec"];

Syntax:

const getDatabaseSettingsOp = new GetDatabaseSettingsOperation(databaseName);
Parameter Type Description
databaseName string The database name for which to get the customized settings.

// Executing the operation returns the following object:
{
    settings // An object with key-value configuration pairs
}