2017-05-08 2 views
0

MongoDBとWSO2 DSSをマッピングしようとしています。しかし、生成されたサービスには障害があり、データのマッピングに関する多くのエラーが発生します。ここでなぜWSO2 DSSマッピングの問題が発生していますか?

は、私が試したものです:

https://gist.github.com/JafferWilson/b4aa22c39205d61a25f2bee5b45a7607

親切に私はWSO2を使用して、私のMongoDBからJSON出力を得るために何をする必要があるかを知ってみましょう。ここでは

<data name="MongoDB" transports="http https local"> 
    <config enableOData="false" id="mongodb"> 
     <property name="mongoDB_servers">127.0.0.1:27017</property> 
     <property name="mongoDB_database">domain_with_email</property> 
     <property name="mongoDB_write_concern">NONE</property> 
     <property name="mongoDB_read_preference">PRIMARY</property> 
    </config> 
    <query id="search" useConfig="mongodb"> 
     <expression>domainemail.find({"domain":#})</expression> 
     <result escapeNonPrintableChar="true" outputType="json" useColumnNumbers="true">{&#xd;"entries":&#xd;{&#xd;"id":"$_id",&#xd;"domain":"$domain",&#xd;"emails":[&#xd; {&#xd; "email":"$email"&#xd; }&#xd;]&#xd;}&#xd;}</result> 
     <param defaultValue="yahoo.com" name="domain" sqlType="STRING"/> 
    </query> 
    <operation name="search"> 
     <call-query href="search"> 
     <with-param name="domain" query-param="domain"/> 
     </call-query> 
    </operation> 
</data> 

はエラーがありますDSS?

答えて

1

私たちはまだWSO2 + Mongoの旅に苦しんでいます。とにかく、これが助けてくれることを望みます。ここではMongoDBの

あなたの場合
<data name="MongoTestDS2" transports="http https local"> 
    <config enableOData="false" id="MongoDS"> 
     <property name="mongoDB_servers">xx.xx.xx.xx</property> 
     <property name="mongoDB_database">mydb</property> 
    </config> 
    <query id="GetTestVals" useConfig="MongoDS"> 
     <expression>things.find()</expression> 
     <result element="Documents" rowName="Document" useColumnNumbers="true"> 
     <element column="document" export="id" name="Data" xsdType="string"/> 
     </result> 
    </query> 
    <query id="InsertTestVals" returnUpdatedRowCount="true" useConfig="MongoDS"> 
     <expression>things.insert("{id:#, name:#}")</expression> 
     <result element="UpdatedRowCount" rowName="" useColumnNumbers="true"> 
     <element column="1" name="Value" xsdType="integer"/> 
     </result> 
     <param name="id" sqlType="STRING"/> 
     <param name="name" sqlType="STRING"/> 
    </query> 
    <query id="GetValsJson" useConfig="MongoDS"> 
     <expression>things.find()</expression> 
     <result outputType="json">{&#xd; "Documents": {&#xd; "Document": [&#xd; {&#xd; "Data": "$document"&#xd; }&#xd; ]&#xd; }&#xd;}</result> 
    </query> 
    <operation name="GetThings"> 
     <description>Test Mongo DB                 &#xd;         </description> 
     <call-query href="GetTestVals"/> 
    </operation> 
    <operation name="PutThings"> 
     <call-query href="InsertTestVals"> 
     <with-param name="id" query-param="id"/> 
     <with-param name="name" query-param="name"/> 
     </call-query> 
    </operation> 
    <operation name="GetThingsJson"> 
     <call-query href="GetValsJson"/> 
    </operation> 
</data> 

に取り組んでJSONサービスのための我々のコードは、私が思うにだ、それはあなたが変更する必要があり、この行です:

<query id="GetValsJson" useConfig="MongoDS"> 
     <expression>things.find()</expression> 
     <result outputType="json">{&#xd; "Documents": {&#xd; "Document": [&#xd; {&#xd; "Data": "$document"&#xd; }&#xd; ]&#xd; }&#xd;}</result> 
</query> 

これは、文字列にすべてのフィールドを返します。

これは、あなたの以前の質問に関連している場合、私はこのチュートリアルでは、別のサービスからマッピングフィールドの次のステップに役立つと思う:私たちの側では https://docs.wso2.com/display/EI611/Transforming+Message+Content

、我々は残念ながらあきらめましたmongodbアダプタをWSO2に付属させ、RESTHeartを使用してmongodbをAPIとして公開しています(http://restheart.org/)これはWSO2が他のREST APIと同じように消費するため、うまくいくようです。

mongodb + WSO2のテストでは、同じ課題の多くが当てはまると確信しています。

+0

私の質問サンプルに分類された方法で文書を表示する方法はありませんか?ドメインタグ付きの電子メールタグとドメインの電子メールのように言ってください。ドキュメントでは、完全なドキュメントjsonを与えるとは思わないでしょう。これは、出力をカテゴリで表示したいと思っています。 –

関連する問題