SlideShare uma empresa Scribd logo
1 de 13
Using Jaspersoft with MongoDB


Mariano Luna
Senior Sales Engineer, Jaspersoft
April 16, 2013
Session Overview

 What is MongoDB?

 Connecting to MongoDB from JasperServer

 The MongoDB Query Language

 Using MongoDB in iReport

 Using Adhoc with MongoDB



©2010 Jaspersoft Corporation. Proprietary and Confidential   2
What is MongoDB



 MongoDB (from "humongous") is an open source
       document database written in C++.

 MongoDB in a nutshell
           Document-Oriented Storage (JSON Documents)
           JSON-style documents with dynamic schemas offer simplicity and
            power.
           Full Index Support. Index on any attribute, just like you're used to.
           Rich, document-based query language.
           Map/Reduce
           Flexible aggregation and data processing.



©2010 Jaspersoft Corporation. Proprietary and Confidential                          3
The Jaspersoft MongoDB Query
Language

 The Jaspersoft MongoDB Query Language is a JSON-
       style declarative language for specifying what data to
       retrieve from MongoDB. The connector converts this
       query into the appropriate API calls and uses the
       MongoDB Java connector to query the MongoDB
       instance.
      There are two types of queries supported:

           API driven queries: These queries rely on the mongo-java-driver support
            provided to query MongoDB.

           Command driven queries: This queries allow the usage of MongoDB
            Aggregation Framework operators


©2010 Jaspersoft Corporation. Proprietary and Confidential                            4
Connecting Jaspersoft to MongoDB

 Creating a JasperServer
       Datasource




 Setting connection URL
                      mongodb://<SERVER>:<PORT>/<COLLECTION>
         and (optional) authentication




©2010 Jaspersoft Corporation. Proprietary and Confidential     5
API Driven Queries

Querying Mongo form Jasper
{
            # The following parameter is mandatory.
            collectionName : myCollection Details,
            # The following parameters are optional
            findQuery : { Details },
            findFields : { Details },
            sort : {Details},
            mapReduce : {Details},
            limit : int Details,
            rowsToProcess : int Details
}




©2010 Jaspersoft Corporation. Proprietary and Confidential   6
Command Driven Queries

Querying mongo form Jasper
{
            runCommand : { Command body },
            # The following parameter is optional
            rowsToProcess : int Details
}

Using runCommand to access the MongoDB aggregation framework
{
     runCommand : {
          aggregate : COLLECTION_NAME,
          pipeline : [ List of aggregation operations ]
     }
}


©2010 Jaspersoft Corporation. Proprietary and Confidential     7
Example Queries

Minimal
{ 'collectionName' : 'accounts’ }


Filtered and parameterized
{
              'collectionName' : 'accounts',
              'findQuery' : {
                   'status_date' : { '$gte' : $P{StartDate} },
                   'name' : { '$regex' : '^N', '$options' : '' }
               }
}




©2010 Jaspersoft Corporation. Proprietary and Confidential         8
Example Queries

Specify the fields returned and sort the results
{
           'collectionName' : 'accounts',
           'findFields' : {
               'name':1,
               'phone_office':1,
               'billing_address_city':1,
               'billing_address_street':1,
               'billing_address_country':1
           },
           'sort' : {
               'billing_address_country':-1,
               'billing_address_city':1
           }
}
©2010 Jaspersoft Corporation. Proprietary and Confidential   9
Example Queries

Using the Aggregation
{
        runCommand: {
           aggregate : 'zips',
           pipeline : [ { $group : { _id : '$state',
                                     population: { $sum : '$pop'
                                     }
                            }
                         },
                         { $sort : { population : -1
                            }
                         }
                      ]
}


©2010 Jaspersoft Corporation. Proprietary and Confidential         10
Demo
Additional Resources

 MongoDB
       http://www.mongodb.org/
      MongoDB Documentation
       http://docs.mongodb.org/manual/
      The Jaspersoft MongoDB Query
       Languagehttp://community.jaspersoft.com/wiki/jaspersoft-
       mongodb-query-language
      Right Outer Join Blog - by Matt Dahlman
       http://mdahlman.wordpress.com/2011/09/02/simple-reporting-on-
       mongodb/

 JasperReports Server Documentation
       http://community.jaspersoft.com/documentation/

©2010 Jaspersoft Corporation. Proprietary and Confidential         12
Thank You

Mais conteúdo relacionado

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Using Jaspersoft with MongoDB

  • 1. Using Jaspersoft with MongoDB Mariano Luna Senior Sales Engineer, Jaspersoft April 16, 2013
  • 2. Session Overview  What is MongoDB?  Connecting to MongoDB from JasperServer  The MongoDB Query Language  Using MongoDB in iReport  Using Adhoc with MongoDB ©2010 Jaspersoft Corporation. Proprietary and Confidential 2
  • 3. What is MongoDB  MongoDB (from "humongous") is an open source document database written in C++.  MongoDB in a nutshell  Document-Oriented Storage (JSON Documents)  JSON-style documents with dynamic schemas offer simplicity and power.  Full Index Support. Index on any attribute, just like you're used to.  Rich, document-based query language.  Map/Reduce  Flexible aggregation and data processing. ©2010 Jaspersoft Corporation. Proprietary and Confidential 3
  • 4. The Jaspersoft MongoDB Query Language  The Jaspersoft MongoDB Query Language is a JSON- style declarative language for specifying what data to retrieve from MongoDB. The connector converts this query into the appropriate API calls and uses the MongoDB Java connector to query the MongoDB instance.  There are two types of queries supported:  API driven queries: These queries rely on the mongo-java-driver support provided to query MongoDB.  Command driven queries: This queries allow the usage of MongoDB Aggregation Framework operators ©2010 Jaspersoft Corporation. Proprietary and Confidential 4
  • 5. Connecting Jaspersoft to MongoDB  Creating a JasperServer Datasource  Setting connection URL mongodb://<SERVER>:<PORT>/<COLLECTION> and (optional) authentication ©2010 Jaspersoft Corporation. Proprietary and Confidential 5
  • 6. API Driven Queries Querying Mongo form Jasper { # The following parameter is mandatory. collectionName : myCollection Details, # The following parameters are optional findQuery : { Details }, findFields : { Details }, sort : {Details}, mapReduce : {Details}, limit : int Details, rowsToProcess : int Details } ©2010 Jaspersoft Corporation. Proprietary and Confidential 6
  • 7. Command Driven Queries Querying mongo form Jasper { runCommand : { Command body }, # The following parameter is optional rowsToProcess : int Details } Using runCommand to access the MongoDB aggregation framework { runCommand : { aggregate : COLLECTION_NAME, pipeline : [ List of aggregation operations ] } } ©2010 Jaspersoft Corporation. Proprietary and Confidential 7
  • 8. Example Queries Minimal { 'collectionName' : 'accounts’ } Filtered and parameterized { 'collectionName' : 'accounts', 'findQuery' : { 'status_date' : { '$gte' : $P{StartDate} }, 'name' : { '$regex' : '^N', '$options' : '' } } } ©2010 Jaspersoft Corporation. Proprietary and Confidential 8
  • 9. Example Queries Specify the fields returned and sort the results { 'collectionName' : 'accounts', 'findFields' : { 'name':1, 'phone_office':1, 'billing_address_city':1, 'billing_address_street':1, 'billing_address_country':1 }, 'sort' : { 'billing_address_country':-1, 'billing_address_city':1 } } ©2010 Jaspersoft Corporation. Proprietary and Confidential 9
  • 10. Example Queries Using the Aggregation { runCommand: { aggregate : 'zips', pipeline : [ { $group : { _id : '$state', population: { $sum : '$pop' } } }, { $sort : { population : -1 } } ] } ©2010 Jaspersoft Corporation. Proprietary and Confidential 10
  • 11. Demo
  • 12. Additional Resources  MongoDB http://www.mongodb.org/  MongoDB Documentation http://docs.mongodb.org/manual/  The Jaspersoft MongoDB Query Languagehttp://community.jaspersoft.com/wiki/jaspersoft- mongodb-query-language  Right Outer Join Blog - by Matt Dahlman http://mdahlman.wordpress.com/2011/09/02/simple-reporting-on- mongodb/  JasperReports Server Documentation http://community.jaspersoft.com/documentation/ ©2010 Jaspersoft Corporation. Proprietary and Confidential 12