☝️Small business or a startup? See if you qualify for our special offer.
+
All documentation
  • Introduction
  • Connecting to data source
    1. Supported data sources
    2. Connecting to other data sources
  • Browser compatibility
  • Documentation for older versions
  • Configuring the MongoDB Connector

    Flexmonster MongoDB Connector is configured through the parameters that can be passed to it during initialization.

    This guide describes the available configurations for Flexmonster MongoDB Connector. To start working with the Connector, see Embedding the MongoDB Connector into the server.

    Available configurations

    Property/TypeDescription
    cacheEnabled
    Boolean
    optional Indicates whether caching on the server is enabled (true) or not (false).
    Default value: true.
    cacheMemoryLimit
    Number
    optional The maximum memory size available for caching (in MB).
    Default value: 0 (unlimited).
    cacheTimeToLive
    Number
    optional Specifies how long the data is stored in the cache. cacheTimeToLive is set in minutes.
    Default value: 0 (cache is stored permanently).
    logsEnabled
    Boolean
    optional Indicates whether logging is enabled (true) or not (false). When enabled, logs are output to the console.
    Default value: false.

    Example

    Here is an example of setting configurations for the Connector:

    In JavaScript

    // Define config
    const config = {
      cacheEnabled: true,
      // Setting cache memory limit to 100 MB
      cacheMemoryLimit: 100,
      // The cache will be stored for two hours
      cacheTimeToLive: 120,
      logsEnabled: true
    }

    // Pass the config when initializing the Connector
    let mongoConnector = new fm_mongo_connector.MongoDataAPI(config);

    In TypeScript

    // Define config
    const config: ConfigInterface = {
      cacheEnabled: true,
      // Setting cache memory limit to 100 MB
      cacheMemoryLimit: 100,
      // The cache will be stored for two hours
      cacheTimeToLive: 120,
      logsEnabled: true
    }

    // Pass the config when initializing the Connector
    let mongoConnector: MongoDataAPI = fm_mongo_connector.new MongoDataAPI(config);

    See also