MongoDB
The MongoDB connector is an interface used to import MongoDB’s schema-less BSON documents into a table schema that Panopticon Designer (Desktop) can interpret and analyze. It uses many BSON structure types and MongoDB query features.
Using MongoDB Files
-
When creating a new data table, select MongoDB from the Connect to Data dialog. The MongoDB Connector dialog displays.
-
In the URL box, you can either:
-
-
enter 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.
-
-
Enter the Replica Set Name which is the name of the replica set in MongoDB, if you opt to connect to secondary servers in a cluster.
-
Select the Read Preference.
The data source read will happen on the selected preference. Default is Primary.
-
Enter the Username and Password if authorization is enabled for MongoDB.
-
Enter the database where the user is created in the Authentication DB box (default is admin) then click Connect.
-
Once connection is established to a MongoDB connection, select a Database and Collection from the drop-down list boxes.
Selecting a database to connect to
Selecting a Collection of data
However, if you do not have access to the Admin database, you can manually enter a Database name and click Connect. Then select a Collection in the populated drop-down list box.
In addition, you can also opt to manually enter Database and Collection names in the list boxes.
-
For column creation, you can opt to do any of the following options:
-
-
Click the Generate Columns button. This will query MongoDB for the first few records and attempt to build your table schema from that information.
NOTES:
-
-
This schema is not always correct and could require some manipulation in order to correctly display data.
-
Generate Columns automatically set all structures to Value and any usage of the advanced features will have to be manually specified.
-
To parse and format times with higher than millisecond precision, the format string needs to end with a period followed by sequence of lower case Fs. There can be no additional characters following them. For example: yyyy-MM-dd HH:mm:ss.ffffff
-
-
Click the Add button. A new row displays in the JSON list box. Enter the necessary information for each column.
-
NOTE: It is recommended to name the column the same as its JSON path for clarity and uniformity. The Structure and Column Count fields are 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.
Click to delete a column in the list. Then click OK in the confirmation message that displays.
-
Select either the dot (.) or comma (,) as the Decimal Separator.
-
You can also opt to make the Query Document feature of MongoDB to be available in Designer. 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.
-
Instead of using Use Query Document, you can select the Parameterize query option. Refer to the Parameterize Feature for more information.
-
The time zone of input parameters and output data is by default unchanged. Changing the time zone is supported through the Timezone list box, based on the assumption that data is stored in UTC time and outputs are presented in the selected time zone.
Likewise, the time zone can also be parameterized.
-
Click OK. Whether you chose to:
-
-
retrieve data after configuring a connection, database, collection, column collection, or
-
entered a query
-
data will populate the sample table in Panopticon Designer (Desktop).
Sample data after retrieving data
Sample data after query documents