<query id="mongo_insert" useConfig="fetchmongo">
<expression>device_attributes.insert("{
"deviceId": #,
"vin": #,
"clusterDetails.provisioned": #,
"clusterDetails.sbEndpoint": #,
"clusterDetails.clusterName": #,
"clusterDetails.clusterId": #,
"clusterDetails.nbEndpoint": #,
"clusterDetails.kubeMaster": #,
"clusterDetails.status": #
}")</expression>
<param name="deviceId" sqlType="INTEGER"/>
<param name="vin" sqlType="STRING"/>
<param name="provisioned" sqlType="STRING"/>
<param name="sbEndpoint" sqlType="STRING"/>
<param name="clusterName" sqlType="STRING"/>
<param name="clusterId" sqlType="STRING"/>
<param name="nbEndpoint" sqlType="STRING"/>
<param name="kubeMaster" sqlType="STRING"/>
<param name="status" sqlType="STRING"/>
</query>
this is my query to insert the data into MongoDB data service. My payload is having object like this trying to insert json its not working so i converted into xml and trying to insert.but its not taking the values object inside object. how to read those values in query
{
"deviceId": 11111,
"vin": "WRTHRKSHS0000011",
"clusterDetails": {
"provisioned": "N",
"sbEndpoint": "192.168.22.22",
"clusterName": "clustertwo",
"clusterId": "cluster11",
"nbEndpoint": "192.168.22.22",
"kubeMaster": "192.168.22.22",
"status": "D"
}
}
And XML object.
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<deviceId>111111</deviceId>
<vin>WERTRKSHS0000011</vin>
<clusterDetails>
<provisioned>N</provisioned>
<sbEndpoint>192.168.22.22</sbEndpoint>
<clusterName>clustertwo</clusterName>
<clusterId>cluster10</clusterId>
<nbEndpoint>192.168.22.22</nbEndpoint>
<kubeMaster>192.168.22.22</kubeMaster>
<status>D</status>
</clusterDetails>
</root>

In the current implementation of data services, only the first-level data is read to extract the parameters, In your case since you have
provisionedas an inner value, the DSS won't be able to extract it. You can follow one of the following to fix your issue,Option 1: If possible change the request structure so all the data are in the same first level as follows
Option 2: Use the
dataServiceCallmediator to call the DSSserviceNameand theoperationname accordingly.For more information,