Jump to content

How to format the filters and conditions of the MongoDB Nosql Query in the Query editor of Jasper studio ?


sugreevu.teja

Recommended Posts

I was able to use my Local MongoDB data into Jasper Studio to create the Reports of my Data by the Connection String and it is successfully connected with our MongoDB, But it is asking us to give the Query.
Even after we gave the query it is ended up with the error, please help me with the Query and the format to use.
Example : I have used one query which takes the condition of element match to go inside an array field in the Json Data by the DateTime Range 
        {
  'collectionName':'Employee',
  'findFields':{
          'details': {
          $elemMatch: {
          'department': 'IT',
          'subdept": "software",
          'leave_period': {
          $gte:"2023-08-05T09:00:00Z",
          $lte:"2023-08-10T20:00:00Z"
        }
      }
    }
  }
}

Edited by sugreevu.teja
Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.
 

Link to comment
Share on other sites

Hi @sugreevu.teja

There are two ways to use the MongoDB connector. 
1. TIBCO JDBC Driver.
2. MongoDB native connector. 
Can you tell us which one you are using?

FYI...For JDBC driver, you need to use SQL query while for the native connector only you can MongoDB syntax. 

Please refer to below Youtube video.

 

Link to comment
Share on other sites

hi @jiman 
Thanks for the response, Actually I tried in both ways 
1. When I'm using the Database JDBC connection, I'm unable to find the option MongoDB which they selected in the video, so i have tried to use direct MongoDB Connection option which only worked for Local Connection string.
2. When I'm using the second option i able to connect locally and created the Data Adapter but when I'm trying to create the Jasper report for that connection it is initially only asking the Query for that I have used the above Query which I mentioned in the previous post, The main problem is I'm giving the but i need to go inside an array object I'm not able to find any Format to code it correctly.

if possible can you tell how to add that MongoDB jdbc option and correct format of the query.

Link to comment
Share on other sites

Hi @sugreevu.teja

1. Which Studio version are you using? Do you have a community edition or commercial edition? The TIBCO MongoDB JDBC driver is only available from Studio 6.2 with commercial license. You can try other MongoDB JDBC driver provided by MongoDB itself.

2. For the MongoDB syntax, you can search for appropriate scenario online and you should get enough examples to query different data structures including arrays with MongoDB syntax.

https://www.mongodb.com/docs/manual/tutorial/query-documents/

https://www.mongodb.com/docs/manual/tutorial/query-arrays/

Thanks.

Edited by jiman
Link to comment
Share on other sites

3 hours ago, jiman said:

Hi @sugreevu.teja

1. Which Studio version are you using? Do you have a community edition or commercial edition? The TIBCO MongoDB JDBC driver is only available from Studio 6.2 with commercial license. You can try other MongoDB JDBC driver provided by MongoDB itself.

2. For the MongoDB syntax, you can search for appropriate scenario online and you should get enough examples to query different data structures including arrays with MongoDB syntax.

https://www.mongodb.com/docs/manual/tutorial/query-documents/

https://www.mongodb.com/docs/manual/tutorial/query-arrays/

Thanks.

Above MongoDB query references were for a MongoDB driver, please refer to below article for the Jaspersoft specific MongoDB Query Language.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...