IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
 View Only
  • 1.  ITX MongoDB Connector

    Posted Tue May 18, 2021 12:21 PM

    Hi All,  I am facing a issue while loading date format in to MongoDB  , Below is the Date format(Highlighted in yellow)  expected in Mongo DB.



    My map output card is build using Json Sample structure 

     

    When i try to load data using map , i see data is loading as string.

    Below is my element properties  ( When i am trying to load as Date , i am getting a error stating target type mismatch so i converted to Text and loading) 


    There are no properties options available to change the data type to Date.

    How can we build output card to identify this field as Date Type

    FYI , When i query data from the same Mongo DB for a Valid Date type row , i see date is retrieved from Mongo DB Collection as Below using ITX Map . 

    "auditHistory": [

                      {

                            "created": {

                                  "$date": 1616686703457

                            },

                            "createdBy": "ESB",

                            "actionCode": "CREATE",

                            "actionDetails": "Created by ESB"

                      }

                ]

     

    Is there a way we can handle the date correctly.



    ------------------------------
    Narendra Chimakurthi
    ------------------------------

    #DataExchange
    #IBMSterlingTransformationExtender


  • 2.  RE: ITX MongoDB Connector

    Posted Wed May 19, 2021 10:59 AM
    Try this:

    =TEXT(CURRENTDATETIME("{CCYY-MM-DD}T{HH24:MM:SS.3-3}"))+"Z"

    Thanks.

    ------------------------------
    Paul Brett
     
    IBM Sterling Transformation Extender (ITX) Client Support
    ------------------------------



  • 3.  RE: ITX MongoDB Connector

    Posted Wed May 19, 2021 11:25 AM
    To get it back into a date field:

    =TODATETIME(LEFT(input,23),"{CCYY-MM-DD}T{HH24:MM:SS.3-3}")

    The LEFT() is required to trim off the 'Z'.

    Thank you.

    ------------------------------
    Paul Brett
     
    IBM Sterling Transformation Extender (ITX) Client Support
    ------------------------------



  • 4.  RE: ITX MongoDB Connector

    Posted Wed May 19, 2021 01:44 PM
    Hi Paul , when i import JSON to generate the Output Card of the Map , the Date field becoming as Text field 

    In properties it is not allowing to Change the Type to Date Format



    ------------------------------
    Narendra Chimakurthi
    ------------------------------



  • 5.  RE: ITX MongoDB Connector
    Best Answer

    Posted Thu May 20, 2021 05:22 AM
      |   view attached
    Yes, MongoDB will return TEXT.  You have to convert that to a date, to use it in other maps/3rd party systems.  See attached example.

    Thank you.

    ------------------------------
    Paul Brett
     
    IBM Sterling Transformation Extender (ITX) Client Support
    ------------------------------

    Attachment(s)

    zip
    MongoDB.zip   9 KB 1 version