Web reporting by MongoDb PivotData Microservice Documentation

Cube schema is specified in the appsettings.json file.

Cube config for Mongo database should have "SourceMongoDb" entry:

  "Id": "restaurants",
  "Name": "Restaurants from MongoDB sample dataset",
  "SourceType": "MongoDb",
  "SourceMongoDb": {
    "ConnectionString": "mongodb://pivotdata:8NXkkC5pbF4NBM5w@ds053166.mlab.com:53166/nrecodemo",
    "Database": "nrecodemo",
    "Collection": "restaurants",
    "FilterJson": ""  /* match JSON */
  "InferSchema": true,  /* dimensions and measures are determined automatically by first N documents */
  "Dimensions": [],
  "Measures": [],
  "Parameters": []

"ConnectionString" is a standard MongoDb connection string in URI format.
"FilterJson" allows to specify $match stage conditions, for example:

    "FilterJson": "{ $and: [ {\"_id\":{$exists:true}}, { \"borough\" : \"Brooklyn\" } ] }"

NOTE: "InferSchema" is useful for one-time or for development purposes; for production use it is better to specify list of dimensions and measures explicitely to avoid some overhead and get full control over cube member options.


In case of MongoDb data source dimension name should refer to the document field name:

  "Dimensions": [
      "Name": "borough",
      "LabelText": "Borough"
      "Name": "address.street",  /* use dot to specify sub-document field */
      "LabelText": "Street"


Measure parameter (if used) should also refer to the document field:

  "Measures": [
       "Type": "Average",
       "Params": [ "grades.score" ],
       "LabelText": "Score Average"


Report parameter tokens could be used in stage definitions ("FilterJson", "StageJson") in the same way as in SQL data sources.