SeekTable can be used as MongoDb reporting tool with built-in native Mongo connector; this connector is also suitable to connect to protocol-compatible databases that support an aggregation pipeline, like Azure Cosmos DB or Amazon DocumentDB.
You can configure 'live' connection to your Mongo database and use it as a data source for pivot tables (charts, grid-views) reports. Data is not imported: SeekTable uses MongoDb aggregate pipeline query ($group) to retrieve the necessary data for the report.
There are no any limitations on the dataset size, but your MongoDb should be able to execute aggregate queries fast enough (in seconds). If you have really huge collections that cannot be aggregated in a real time you can apply database-level filtering with report parameters or you can hardcode some filter in Filter JSON to limit number of documents to process. Alternatively you can use pre-aggregated collections for the low-granularity reports.
mongodb://user:password@host:port/database[?options]
connect=replicaSet
, replicaSet=yourSet
, authSource=yourAuthDB
?ssl=true
(this option is required for Azure CosmosDB)If everything is fine you should see a new cube dashboard with the list of available dimensions. In case of connection error you'll see an orange box with the error message.
Dimensions determine what document fields may be used as grouping criteria. It is possible to project dimension by specifying calculation as 1-st "Parameter".
Field
: dimension value is a document field or result of $project specification (can be provided as first "Parameter").
Expression
: dimension is defined as calculated field with custom formula that uses another dimension(s) as argument(s); formula and arguments are specified in "Parameters".
Field
this is document or sub-document field specifier like field.sub_field
.{0}
can be used).
Examples:
prefix {0} suffix
→ append custom prefix and/or suffix{0:yyyy-MM-dd}
→ format date (or timestamp) as 2017-05-25{0:MMM}
→ format month number (1-12) as a short month name (Jan, Feb etc){0:MMMM}
→ format month number (1-12) as a full month name (January, February etc){0:ddd}
→ format day-of-week number (0-6) as a short day-of-week name (Mon, Tue etc){0:dddd}
→ format day-of-week number (0-6) as a full day-of-week name (Monday, Tuesday etc)Field
: first value can be a JSON with custom projection. For example: {$year:"$date_field"}
.
project.release_date-year
.
Expression
: first value is an
expression, and next values are arguments (names of another dimensions).
To define date-part dimensions (date's "year", "month", "day" etc) you may add dimensions defined with an appropriate Mongo projection:
Field
{$cond: [{ $ifNull: ["$date_field", 0] }, {$year:"$date_field"}, null]}
{$cond: [{ $ifNull: ["$date_field", 0] }, {$month:"$date_field"}, null]}
+ Format={0:MMM}
(Jan, Feb etc) or {0:MMMM} (January, February etc)
{$cond: [{ $ifNull: ["$date_field", 0] }, {$dayOfMonth:"$date_field"}, null]}
{$cond: [{ $ifNull: ["$date_field", 0] }, {$subtract:[ {$isoDayOfWeek:"$date_field"}, 1]}, null]}
+ Format={0:ddd}
(Mon, Tue etc) or {0:dddd}
(Monday, Tuesday etc){$cond: [{ $ifNull: ["$date_field", 0] }, { $dateTrunc: { date: "$date_field", unit: "quarter" } }, null]}
(MongoDB 5+){$cond: [{ $ifNull: ["$date_field", 0] }, {$isoWeek:"$date_field"}, null]}
Count
: the number of aggregated documents.Sum
: the total sum of a numeric field.Average
: the average value of a numeric field.Min
: the minimal value of a column.Max
: the maximum value of a column.FirstValue
: custom acummulator aggregation pipeline expression (not supported yet for MongoDb).Expression
: measure is defined as a formula expression that is calculated on SeekTable side.Count
: no parameters needed.Sum
/Average
/Min
/Max
: document field or field path to aggregate.FirstValue
: collects field value of the first document.Expression
: first parameter is formula expression, and next parameters are names of measures used as arguments in the expression.
{0}
can be used).
Examples:
{0:$#.##}
→ format number as $10.25 (or empty if no value){0:0,.0#}k
→ show number in thousands with "k" suffix{0:0.#|k}
→ if number>1000 shorten it with "k" suffix{0:0,,.0#}M
→ show number in millions with "M" suffix{0:0.#|M}
→ if number>1000000 shorten it with "M" suffix{0:0.#|kMB}
→ shorten large number with appropriate "k"/"M"/"B" suffixReport parameters are used when you need to declare user-defined variable and use it in the Mongo aggegate pipeline stages; typical usage is database-level filtering with Filter JSON, but parameter placeholders may be used in Custom Stage entries as well.
String
: text-based value.Int32
: 32-bit integer (max value is 2,147,483,647).Int64
: 64-bit integer (max value is 9,223,372,036,854,775,807).Decimal
: Fixed-point number with max 28 significant digits. Decimal point is '.' character.DateTime
: datetime or date value (in this case datetime value has 0:00:00 time). Date value should be specified as string in YYYY-MM-DD format.Boolean
: accepts only 'True' or 'False' value.Parameter["param_name"]
.When parameter is defined it can be used in Filter JSON as following:
{ $and: [ {"_id":{$exists:true}}, @borough[ {{ "borough" : {0} }}, ] @cuisine[ {{ "cuisine" : {{ $regex : {0} }} }}, ] ] }where:
{"_id":{$exists:true}}
just 'always true' part of $and condition (for case when params are not defined)borough
is should be equal to appropriate document field. Note that parameter placeholder (inside square brackets) {
and }
should be escaped as {{
and }}
cuisine
is compared as 'like' with appropriate document fieldParameter's placeholder syntax:
@
orderDate
[ ]
@paramName[ json_when_defined ; json_when_NOT_defined ]
{0}
Notes:
@country[ {{ "country" : {{ $in : {0} }} }}, ]
;
→ ;;
or \;
]
→ ]]
or \]
{
→ {{
or \{
}
→ }}
or \}
\
→ \\
@
→ \@
@parameter1[ @parameter2[ {{ "field" : {0} }}, ] ](= apply "parameter2" only if "parameter1" is defined)