We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.
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

    This guide describes how to configure Flexmonster MongoDB Connector. For instructions on using the Connector, see Embedding the MongoDB Connector into the server.

    Available configurations

    Flexmonster MongoDB Connector can be configured through the ConfigInterface object, which has the following properties:

    Property/TypeDescription
    cacheEnabled
    Boolean
    optional Defines whether caching is enabled.
    Default value: true (caching is enabled).
    cacheMemoryLimit
    Number
    optional The maximum memory size available for caching (in MB).
    Default value: 0 (unlimited).
    cacheTimeToLive
    Number
    optional Defines how long the data is stored in the cache. cacheTimeToLive is set in minutes.
    Default value: 0 (cache is stored permanently).
    logsEnabled
    Boolean
    optional Defines whether logging is enabled.
    Default value: false (logging is disabled).

    Examples

    Here is an example of setting configurations for the Connector:

    In JavaScript

    // Define config
    let 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 _apiReference = new MongoDataAPI(config);

    In TypeScript

    // Define config
    let 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 _apiReference: MongoDataAPI = new MongoDataAPI(config);