简体   繁体   English

如何使用WSO2 DSS从mongodb获取第二条记录?

[英]How I can get the second record from mongodb using WSO2 DSS?

I have connected the MongoDB successfully and now have also accessed the mongodb records using WSO2 DSS tryit tool. 我已经成功连接了MongoDB,现在还使用WSO2 DSS tryit工具访问了mongodb记录。 Here is what I received while accessing the records: 这是我在访问记录时收到的:

使用DSS的Mongo输出

As you see I get the output as: 如您所见,我的输出为:

 <data>{ "_id" : { "$oid" : "589d96d841a427c4389a38d5"} , "domain" : "yahoo.com" , "emails" : [ { "email" : "fghj"} , { "email" : "dfghjk"}]}</data>
   <data>{ "_id" : { "$oid" : "589d993a41a427c4389a38d8"} , "domain" : "yahoo.com" , "emails" : [ { "email" : "fghj"} , { "email" : "dfghjk"}]}</data>

As you see there is _id in the output. 如您所见,输出中有_id I intent to remove it. 我打算将其删除。 But could not. 但是不能。

The query I placed in WSO2 DSS is like this: 我在WSO2 DSS中放置的查询是这样的:

collect.find({"domain":#},{"_id":0})

Where collect is the name of my collect of mongodb. 我的mongodb集合名称在哪里collect是。

Here s the json structure that I have placed in the ooutput mapping area on WSO2 DSS: 这是我在WSO2 DSS的ooutput映射区域中放置的json结构:

{"entries":{"data":$document}}

I do not understand what to do in order to exclude or neglect the _id field and get only the domain part as it is in my output window. 我不知道如何排除或忽略_id字段并仅获得域部分,因为它在我的输出窗口中。
Kindly suggest me what I can do to make my work done. 请建议我可以做些什么来完成我的工作。

I'm totally new to WSO2, but we have the same surname ;) so I'll try to help. 我对WSO2完全陌生,但是我们有相同的姓;),所以我将尽力提供帮助。

I'm not sure you can remove the _id field, but I think the correct way to handle this is to create a proxy service, that runs through the json and returns only the fields that you want. 我不确定您是否可以删除_id字段,但是我认为处理此问题的正确方法是创建一个代理服务,该服务运行json并仅返回所需的字段。

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM