WSO2 - 更新mongoDB期间出错

时间:2017-05-04 02:23:35

标签: mongodb wso2

我使用的是WSO2 Enterprise Integrator(EI)版本6.1.0。我创建了更新服务,如下所示:

emailcollection.update({ id: #},{$set: {email: "test@test.com.my"}},{ upsert: false });

因此,查询要按参数给出的id设置新电子邮件。如果我运行该服务,它将提示以下错误:

Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in MongoQuery.runQuery: Unable execute update operation using query { id: #}
DS Code: UNKNOWN_ERROR
Source Data Service:-
Name: emailMongo
Location: \emailMongo.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: updEmail
Current Params: {id=1222}
Nested Exception:-
java.lang.IllegalArgumentException: Unable execute update operation using query { id: #}

    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:102)
    at org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:73)
    at org.wso2.carbon.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:357)
    at org.wso2.carbon.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:41)
    at org.wso2.carbon.dataservices.core.DBInOutMessageReceiver.invokeBusinessLogic(DBInOutMessageReceiver.java:57)
    ... 9 more
Caused by: DS Fault Message: Error in MongoQuery.runQuery: Unable execute update operation using query { id: #}
DS Code: UNKNOWN_ERROR
Source Data Service:-
Name: emailMongo
Location: \emailMongo.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: updEmail
Current Params: {id=1222}
Nested Exception:-
java.lang.IllegalArgumentException: Unable execute update operation using query { id: #}

    at org.wso2.carbon.dataservices.core.description.query.MongoQuery.runPreQuery(MongoQuery.java:85)
    at org.wso2.carbon.dataservices.core.description.query.Query.execute(Query.java:297)
    at org.wso2.carbon.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:286)
    at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
    at org.wso2.carbon.dataservices.core.description.operation.Operation.execute(Operation.java:61)
    at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:599)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:96)
    ... 13 more
Caused by: java.lang.IllegalArgumentException: Unable execute update operation using query { id: #}
    at org.jongo.Update.createQuery(Update.java:86)
    at org.jongo.Update.<init>(Update.java:38)
    at org.jongo.MongoCollection.update(MongoCollection.java:128)
    at org.jongo.MongoCollection.update(MongoCollection.java:117)
    at org.wso2.carbon.dataservices.core.description.query.MongoQuery$MongoQueryResult.doUpdate(MongoQuery.java:434)
    at org.wso2.carbon.dataservices.core.description.query.MongoQuery$MongoQueryResult.<init>(MongoQuery.java:353)
    at org.wso2.carbon.dataservices.core.description.query.MongoQuery.runPreQuery(MongoQuery.java:83)
    ... 19 more
Caused by: java.lang.IllegalArgumentException: Not enough parameters passed to query: { id: #}
    at org.jongo.query.BsonQueryFactory.createQuery(BsonQueryFactory.java:88)
    at org.jongo.Update.createQuery(Update.java:83)

如果在没有解析参数/硬编码值的情况下运行它,那么它运行良好。

请帮忙。

0 个答案:

没有答案