Hi Chamila, Just use "TestCollection.findOne()" as the query expression, basically drop the "db" part. It should work then.
Cheers, Anjana. On Mon, Dec 1, 2014 at 1:38 PM, Chamila De Alwis <[email protected]> wrote: > Hi, > > I'm trying to query a mongoDb, using the following data service. > > <data name="testMongoService"> > <config id="capedev-mongo"> > <property name="mongoDB_servers">172.17.0.4:27017</property> > <property name="mongoDB_database">*TestDB*</property> > <property name="mongoDB_write_concern">NONE</property> > <property name="mongoDB_read_preference">PRIMARY</property> > <property name="mongoDB_autoConnectRetry">true</property> > </config> > <query id="mongo_find" useConfig="capedev-mongo"> > <expression>*db.TestCollection.findOne()*</expression> > </query> > <operation name="mongo_find"> > <description>mongo find operation</description> > <call-query href="mongo_find"/> > </operation> > <resource method="GET" path="test"> > <call-query href="mongo_find"/> > </resource> > </data> > > > I can't get data from this service, it fails with the following error > message. However I can execute the same expression on the mongo db browser > I'm using because I've created the TestDB database and the TestCollection > collection. > > <soapenv:Fault xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" > xmlns:axis2ns38="http://ws.wso2.org/dataservice"> > <soapenv:Code> > <soapenv:Value>axis2ns38:UNKNOWN_ERROR</soapenv:Value> > </soapenv:Code> > <soapenv:Reason> > <soapenv:Text xml:lang="en-US">DS Fault Message: Error in DS non > result invoke. > DS Code: UNKNOWN_ERROR > Nested Exception:- > javax.xml.stream.XMLStreamException: DS Fault Message: Error in > MongoQuery.runQuery: DS Fault Message: *Unknown MongoDB operation > 'TestCollection.findOne'* > DS Code: UNKNOWN_ERROR > > DS Code: UNKNOWN_ERROR > Source Data Service:- > Name: testMongoService > Location: /testMongoService.dbs > Description: N/A > Default Namespace: http://ws.wso2.org/dataservice > Current Request Name: mongo_find > Current Params: {} > Nested Exception:- > DS Fault Message: Unknown MongoDB operation 'TestCollection.findOne' > DS Code: UNKNOWN_ERROR > > > </soapenv:Text> > </soapenv:Reason> > <soapenv:Detail> > <axis2ns37:DataServiceFault xmlns:axis2ns37=" > http://ws.wso2.org/dataservice"> > <axis2ns37:current_params>{}</axis2ns37:current_params> > > <axis2ns37:current_request_name>mongo_find</axis2ns37:current_request_name> > <axis2ns37:nested_exception>DS Fault Message: Unknown MongoDB > operation 'TestCollection.findOne' > DS Code: UNKNOWN_ERROR > </axis2ns37:nested_exception> > <axis2ns37:source_data_service> > <axis2ns37:location>/testMongoService.dbs</axis2ns37:location> > <axis2ns37:default_namespace>http://ws.wso2.org/dataservice > </axis2ns37:default_namespace> > <axis2ns37:description>N/A</axis2ns37:description> > > <axis2ns37:data_service_name>testMongoService</axis2ns37:data_service_name> > </axis2ns37:source_data_service> > <axis2ns37:ds_code>UNKNOWN_ERROR</axis2ns37:ds_code> > </axis2ns37:DataServiceFault> > </soapenv:Detail> > </soapenv:Fault> > > > Regards, > Chamila de Alwis > Software Engineer | WSO2 | +94772207163 > Blog: code.chamiladealwis.com > > > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- *Anjana Fernando* Senior Technical Lead WSO2 Inc. | http://wso2.com lean . enterprise . middleware
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
