I try to connect to mongoDB using WSO2 DSS and its mongoDB data source and present the result via a service. When setting the output mapping for a simple query result I cannot access the individual objects attributes. The only way to access the result is through a "virtual" column "document". For instance for a query like this:
<query id="mongo_find" useConfig="mongo_ds">
<expression>things.find()</expression>
<result outputType="json">
{
"entries": {
"entry": [
{
"field1": $document
}
]
}
}
</result>
</query>
I get results like this:
<entry>
<field1>
{ "_id" : { "$oid" : "54e489adb4ca0903f9675824"} , "x" : 3.0}
</field1>
</entry>
However I would like to map the field1 directly to the "_id" attribute. Unfortunatelly I am unable to figure out how? The samples in documentation are not much help in this.