Jump to content
  • How to concatenate fields using MongoDB Query language


    vchiem
    • Features: Data Sources Version: v7.5 Product: JasperReports® Server

    Issue:

    We need to concatenate two fields 'firstname' and 'lastname' into one field using Jaspersoft MongoDB Query language. 

    How can this be achieved ?

     


     

    Solution:

    The following MongoDB Reference:

    https://docs.mongodb.com/manual/reference/operator/aggregation/concat/index.html

    has usages on how to perform a concatenation of string fields.

    You can use the $concat operator within the aggregate operator. 

    Example for TIBCO JasperReports Server version 7.5:

    {
        collectionName : 'address',
        aggregate : [
            { $project : {  
                 fullname : { $concat: [ "$firstname", " - ",  "$lastname"] } 
                             } 
               } 
        ]
     }

     

    Related Articles:

    https://community.jaspersoft.com/wiki/jaspersoft-mongodb-query-language


    User Feedback

    Recommended Comments

    There are no comments to display.



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