Altair® Panopticon

 

Creating Data Extract from MongoDB

The MongoDB connector is an interface used to import MongoDB’s schema-less BSON documents into a table schema that Panopticon Real Time can interpret and analyze. It uses many BSON structure types and MongoDB query features.

Steps:

1.     On the New Data Extract page, select MongoDB in the Connector drop-down list.

 

2.     Enter the following properties:

Property

Description

URL

Enter either:

·         localhost if the database resides on the same computer, or

·         enter the IP address and port of the computer where MongoDB is installed (e.g., 192.168.1.1:27017). If no port is specified, the default is 27017.

User Id

The user Id that will be used to connect to MongoDB.

Password

The password that will be used to connect to MongoDB.

Authentication DB

The database where the user is created.

Database

The database that will be used.

Collection

The collection that will be used.

 

3.     You can also opt to make the Query Document feature of MongoDB to be available in Panopticon Real Time. Select Use Query Document in the Query Options drop-down list.

This also displays the Method drop-down. Select either Find (Default) or Aggregate.

When Aggregate is selected, you can add all the columns generated by aggregation in the schema.

In addition, the MongoDB command line interface displays query operations with a JSON style syntax.

Enter your desired JSON query document. Refer to http://docs.mongodb.org/manual/tutorial/query-documents/  for more information on the Query Documents feature on MongoDB.

For example:

Queries from the documentation look like this: db.inventory.find ( {type: “snacks”} ). The database and collection are already defined in the UI and the Find operation is handled in the code. The user only needs to enter the query document:

{ type : “snacks” }

This query must include surrounding curly braces as well as matching internal braces should the user decide to make a more advanced query.

4.     Instead of using Use Query Document, select the Parameterize query option.

Click  to populate the Parameter drop-down and select a value. Then select what column to filter on in the Filter By drop-down.

5.     Select either the dot (.) or comma (,) as the Decimal Separator.

6.     Select the Data Type Discovery. This property specifies how many rows to fetch from the input data source, when auto generating the schema after clicking  .

 

7.     You can also opt to load or save a copy of the column definition.

8.     Click . A new row displays in the JSON list box. Enter the necessary information for each column.

Property

Description

Name

The column name of the source schema.

NOTE:  It is recommended to name the column the same as its JSON path for clarity and uniformity.

JsonPath

The JsonPath of the source schema.

Type

The data type of the column. Can be a Text, Numeric, or Time

Structure

Used for more advanced features and are covered in the Row-Wise Array Expansion, Column-Wise Array Expansion, and Bson-Wise Array Expansion  sections. Value is the default structure and will always display data regardless of actual structure.

Column Count

Enabled when Column-Expanded Array structure is selected.

Enter the number of columns for the plugin to generate as columns for that array.

Date Format

The format when the data type is Time.

NOTE:

To parse and format times with higher than millisecond precision, the format string needs to end with a period followed by sequence of upper case S. There can be no additional characters following them.

For example: yyyy-MM-dd HH:mm:ss.SSSSSS

Enabled

Determines whether the message field should be processed.

 

To delete a column, check its  or all the column entries, check the topmost , then click .

9     Click    to save and display the details of the data extract.

10.     Click   then   to display the data preview.

 

 

Row-Wise Array Expansion

MongoDB’s BSON document structure can store array data types. In order to interpret that data, the user has to decide how they want those multi-value fields to be displayed.

Row-wise array expansion takes an array of values and expands them in a single column creating a new row for each value in the array. If there are multiple row-expanded arrays in the same document, then the number of rows generated is equal to the largest array size. Additionally, an Automatic x-axis column is automatically generated for use as an x-axis value for visualizations using array data.

To use the row-wise array expansion feature, select Row-Expanded Array from the Structure drop-down box.

This feature will only work for an array data type. If the actual data type in MongoDB is not array or the array is empty, the column will not populate.

 

Column-Wise Array Expansion

MongoDB’s BSON document structure can store array data types. In order to interpret that data, the user has to decide how they want those multi-value fields to be displayed.

Column-wise array expansion takes an array of values and expands them into multiple table columns creating a number of columns equal to an array specific number set by the user. If there are multiple column-expanded arrays in the same document, the combined number of new columns is appended to the end of the table with their respective array indices and the original columns are removed.

To use the column-wise expansion feature, select Column-Expanded Array in the Structure drop-down box.

The corresponding Column Count text box will be enabled and the user can enter the number of columns for the plugin to generate as columns for that array.

 

Bson-Wise Array Expansion

MongoDB’s BSON document structure can store array data types. In order to interpret that data, the user has to decide how they want those multi-value fields to be displayed.

Bson-wise array expansion allows parsing of all the fields of a nested hierarchy in a sub document of a JSON array. During data retrieval, the column value is converted to JSON, and nested columns are flattened based on a JSON parser logic.

To use the Bson-wise expansion feature, select Bson-Expanded Array in the Structure drop-down box.