Jump to content

Ireport e MongoDb Query (array)


Recommended Posts

Hello ,
I'm trying to understand how use MongoDb Query but syntax and concepts are not clear to me (I'm functional not developer).
In this easy query I'm trying to show fields and also nested value into array fields . In this case containers.trackables.code

{ 'collectionName' : 'TrackDocument' ,
findFields : { 'docDate':1, 'docNumber':1, 'docStatus':1 , 'containers.trackables.code' : 1}, 
}
I would like to see only the code and not all the mess of things into the container colum.
How can achieve that ?
For istance in first row I got two value  45500027  and 45500999 that would be the detail rows .

I hope someone can help me because I'm very stuck....    Thanks
 

converted-file.png.28ba2c48f8fd5c7994f4626e2aeac5c1.png

 

 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Hello,

It looks like your requirement is more into SQl context how to write sql query to display specific portion of column than ireport design.

You can use SQL string replace function to replace e.g. [{"trackables" : [{"code" : part of container column with space.
You might need to use more such replace and concatinate SQL functions to write the query.
 

Link to comment
Share on other sites

Sorry but to query MongoDb from Ireport is not possible using SQL. The only way is to use MongoDbQuery within Ireport with its specific sintax.
If it would be a sql DB the issue was not existing.
Attached the json of that collection . If you are able to use SQL please let me no how.
Thanks

 

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...