How to insert date with date datatype rather than string type in MongoDB plugin.
book
Article ID: KB0071667
calendar_today
Updated On:
Products
Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for MongoDB
6.4.0
Description
If we are using the render JSON activity and we want to insert the Date as datatype date rather than the string type.
Issue/Introduction
using the Render JSON and Parse JSON activity we can insert date with datatype "date" rather than string type in the MongoDB plugin.
Environment
==================
Product : TIBCO ActiveMatrix BusinessWorks Plug-in for MongoDB
Version : 6.4.0
OS: All Supported Operating Systems
=================
Resolution
Step to insert the date type data in MongoDB using the Render JSON, Parse JSON, and InsertDocument activity.
1. create the MongoDBConnectionResource 2. create process as started activity---->Render JSON--->Parse JSON activity---->InsertDocument activity. 3. Goto the properties of Render JSON activity. a) In the general tab select the schema type generic and Output JSON style as JSON with Root. b)In the input tab provide an XML string as input and the output of Render JSON activity will be JSON string (i.e "<OutputElement><date>2009-09-19T14:53:56Z</date></OutputElement>")
4. Goto the properties of Parse JSON activity. a) In the general tab select the schema type Xsd and Input JSON style as JSON with Root. b) In the output editor tab create the XSD schema as date having type string. c) In the input tab map the output of Render JSON activity.
5. Goto the properties of InsertDocument activity. a) In the general tab select the MongoDB connection resource and provide the collection name on which we need to perform the operation. b) In the input tab Concat the output of parse JSON activity (i.e concat('{date:ISODate("',$ParseJSON/tns3:date,'")}')).
Attachments
How to insert date with date datatype rather than string type in MongoDB plugin.
get_app