PowerExchange for MongoDB User Guide

PowerExchange for MongoDB User Guide

MongoDB as an Operation Data Store – An Example

MongoDB as an Operation Data Store – An Example

A large online music store, Moose, uses MongoDB as the operational data store for the business inventory details.
The business analysts at Moose use a business intelligence tool that does not support reading data from MongoDB. The tool requires the input data to be in a relational database or a flat file.
The data warehouse includes a collection called Music_Contents. The collection Music_Contents contains a catalog of all of the songs in the store. You must move the data in the collection to a flat file to use the data for business analysis. You must also remove those records with zero units to ensure that the data is current.
The following table describes the structure of Music_Contents:
Field
Dataype
Name
String
Type
Array of strings
Artist
Array of strings
Units
Int
Price
Nested document
The following table describes the structure of the nested document, Price:
Field
Datatype
Cost_Price
Int
Sale_Price
Int
The following document is a sample from the collection, Music_Contents:
{ "Name" : "Happy Birthday", "type" : ["Folk", "Traditional"], "Artist" : ["Patty Hill", "Mildred J. Hill", "Derek Underhill"], "Units" : 1000, "Price" : { "Cost_Price" : 1, "Sale_Price" : 3 } }
Create a mapping with a MongoDB data object as the read transformation to read the records from the collection. Include a flat file data object as the target in the mapping so that the business intelligence tool can consume the data. Use a Filter transformation to remove the documents that have zero units.
Create a mapping that has a MongoDB data object in read mode, a Filter transformation, and a flat file data object in write mode. The MongoDB reader mapping contains the following components:
MongoDB ODBC Data Object
Import the collection Store_Catalog as an ODBC data object.
The following figure shows the data object created from the collection:
Filter transformation
The filter transformation applies a filter on the Units field and writes those records that have one or more units in the Units field.
The Filter transformation with Units > 0 condition.
Flat file data object
The flat file data objec,t ff_Music_Collection, in the write mode, contains the same columns as in the MongoDB ODBC Source Definition.
The following figure shows the mapping:
The MongoDB reader mapping that reads data from MongoDB and writes to a flat file.

Back to Top

0 COMMENTS

We’d like to hear from you!