Element Details: DataLayer.Mongo+Map+Reduce
 Back


Available in: Logi Info Source code name: DataLayer.MongoMapReduceIntroduced in: v11.2.040

DataLayer.MongoMapReduce runs a Mongo Map Reduce command designed to return one or more documents.

MongoDB results are often very hierarchical. There may be many levels. The information often must be tabularized to work with other Info elements. This can be done with the Flattener element under this DataLayer.

Map Reduce Jobs should have a Map Function, for example:
"function() { emit(this.cust_id, this.price); };"

and a Reduce Function, for example:
"function(keyCustId, valuesPrices) {
return Array.sum(valuesPrices);
};"

You can also include an optional Finalize Function, which runs after the map reduce job has completed and could look like this:

"function (key, reducedVal) {
reducedVal.avg = reducedVal.qty/reducedVal.count;
return reducedVal;
};"

The Map Reduce job will then be run and the values returned from the reduce function (and the finalize function if it is used) will be accessible as tokens.

MongoMapReduce has a result size limit of 16MB.

Element Group:Big Data DataLayers



ATTRIBUTES

Click attribute Name to drill down for more information.

NamePossible ValuesDescription
ConnectionID
UserDefined
(Required) Specifies a connection to a data source that is defined in the Settings. For elements connecting to relational databases, default is the first Connection element in _settings.lgx.
FinalizeFunction
UserDefined
Optional. Follows the reduce method and modifies the output.
ID
UserDefined
(Required) The ID attribute is a pervasive attribute that uniquely identifies an element within a definition file. The ID needs to be a unique value within the definition.
MapFunction
UserDefined
(Required) A JavaScript function that associates or “maps” a value with a key and emits the key and value pair.
MaxRows
UserDefined
The maximum number of rows to retrieve from the data source.
MongoCollection
UserDefined
(Required) Name of the Mongo collection.
MongoQueryDocument
UserDefined
MongoQueryDocument specifies a Mongo "find" document to identify one or more documents. To vary the document content based on user or other input, use tokens inside the document, such as @Request tokens. Examples: Find all documents with "type" equal to "snacks". { type: "snacks" } Find all documents with "type" equal to "food" or "snacks" { type: { $in: [ "food", "snacks" ] } }
ReduceFunction
UserDefined
(Required) A JavaScript function that “reduces” to a single object all the values associated with a particular key.



PARENT ELEMENTS

Click element to drill down for more information.

Analysis Chart
Analysis Grid
Animated Chart.Pie
Animated Chart.Scatter
Animated Chart.XY
Animated Extra Scatter Layer
Animated Gauge.Bar
Animated Gauge.Needle
Animated Gauge.Pyramid
Animated Map
Authentication
Auto Complete
Bulk Email Data Layer
Chart Canvas
Chart Grid
Chart.Gantt
Chart.Heatmap
Chart.Pie
Chart.Polar
Chart.Polar
Chart.Scatter
Chart.XY
Crosstab Table
Data Calendar
Data List
Data Menu
Data Multi-Column List
Data Table
Data Tree
DataLayer.Cached
Default Values
Email List
External Definitions
Extra Gantt Column
Extra Grid Layer
Extra Polar Layer
Extra Scatter Layer
Extract
Gauge.Angular
Gauge.Arc
Gauge.Balloon Bar
Gauge.Bar
Gauge.Bullet Bar
Gauge.Indicator
Gauge.Needle
Gauge.Number
If Data Error
Input Checkbox List
Input Combo List
Input Radio Buttons
Input Select List
Interactive Data View Applet
Join
Json Data
Local Data
Lookup
Map Markers
Map Polylines
Marker Band
Marker Line
Marks
Milestone Column
Pattern Block
PDF Form
Procedure.Data
Procedure.Run Datalayer Rows
Procedure.Run DataTable Rows
Right
Right From Role
Rights From DataLayer
Series.Area
Series.Area Range
Series.Area Spline
Series.Area Spline Range
Series.Bar
Series.Bar Range
Series.Box Plot
Series.Bubble
Series.Funnel
Series.Heatmap
Series.Line
Series.Pie
Series.Pyramid
Series.Scatter
Series.Spline
Series.Waterfall
Series.Whiskers
Sharing List
Sparkline.Area
Sparkline.Bar
Sparkline.Line
Sparkline.WinLoss
Subdata Layer
Table
Text Cloud
User Roles
Word Form
Xml Data
XOLAP Cube
XslFo Data


CHILD ELEMENTS

Click element to drill down for more information.

Calculated Column
Color Range Column
Color Spectrum Column
Compare Filter
Condition Filter
Contain Filter
Crosstab Filter
Data Layer Link
Data Layer Plugin Call
DeDuplicate Filter
Difference Column
File Column
Flattener
Forecast.Current Time Period
Forecast.Regression
Forecast.Time Series Decomp
Formatted Column
Geocode Columns
Group Filter
If Data Error
Join
Lookup
Moving Average Column
Percent of Total Column
Predicted Column
Rank Column
RegEx Filter
Relevance Filter
Remove Columns
RenameColumns
Reverse Geocode Columns
Running Total Column
Security Filter
Sequence Column
Sort Filter
Switch Column
Time Period Column
UnCrosstab Filter
Unit Conversion Column


 Back to top


 Chart Debug