过滤器的 RESTHeart 问题 [英] RESTHeart issue with filters

查看:35
本文介绍了过滤器的 RESTHeart 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在 mongodb 之上使用 RESTHeart 来对 Mongodb 的 REST 接口提供 crud 支持.当我不使用任何过滤器时它工作正常,但是当我尝试使用 文档 堆栈跟踪出错,如下所示.

I've been using RESTHeart on top of mongodb to have crud support with Mongodb's REST interface. Its working fine when I'm not using any filter, however when I tried to apply filter with the HTTP GET request as provided in the documentation I got error with the stacktrace as provided below.

请求:http://127.0.0.1:8080/inBeta/donor?filter="{'name':'john'}"

14:15:49.373 [XNIO-1 task-1] 错误 c.s.restheart.handlers.ErrorHandler- 错误处理请求 java.lang.ClassCastException: java.lang.String 不能转换为 org.bson.BSONObject在 com.softinstigate.restheart.db.CollectionDAO.lambda$getCollectionData$45(CollectionDAO.java:178)~[restheart.jar:0.9.7]在 com.softinstigate.restheart.db.CollectionDAO$$Lambda$20/1288164368.accept(未知来源)~[na:na]在 java.util.ArrayDeque$DeqSpliterator.forEachRemaining(Unknown来源)~[na:1.8.0_31]在 java.util.stream.ReferencePipeline$Head.forEach(Unknown Source) ~[na:1.8.0_31]在 com.softinstigate.restheart.db.CollectionDAO.getCollectionData(CollectionDAO.java:177)~[restheart.jar:0.9.7]

14:15:49.373 [XNIO-1 task-1] ERROR c.s.restheart.handlers.ErrorHandler - error handling the request java.lang.ClassCastException: java.lang.String cannot be cast to org.bson.BSONObject at com.softinstigate.restheart.db.CollectionDAO.lambda$getCollectionData$45(CollectionDAO.java:178) ~[restheart.jar:0.9.7] at com.softinstigate.restheart.db.CollectionDAO$$Lambda$20/1288164368.accept(Unknown Source) ~[na:na] at java.util.ArrayDeque$DeqSpliterator.forEachRemaining(Unknown Source)~[na:1.8.0_31] at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source) ~[na:1.8.0_31] at com.softinstigate.restheart.db.CollectionDAO.getCollectionData(CollectionDAO.java:177) ~[restheart.jar:0.9.7]

当我没有应用任何过滤器返回的 JSON 对象,但是使用过滤器返回的 BSON 对象时,RESTHeart 无法将其转换为 JSON 响应.将不胜感激任何帮助或指导来调查这个问题.

When I didn't apply any filter its returning JSON object, however with filters its returning BSON object which RESTHeart is unable to convert as JSON response. Will appreciate any help or direction to look into the issue.

附言RESTHeart 没有标签,所以如果有人可以为相同的标签创建标签会很有帮助.

P.S. There is no tag for RESTHeart, so it would be helpful if someone could create a tag for the same.

推荐答案

问题终于解决了 :)

我尝试使用文档中提供的其他 API,发现除过滤器外一切正常,因此使用以下请求尝试请求:

I tried using other APIs provided in documentation and found that everything is working except filter and hence trying out the request using the below request:

http://127.0.0.1:8080/inBeta/donor?filter=%7B'username':'john'%7D

成功了.因此,罪魁祸首是过滤器查询周围的双引号.

it worked. Hence the culprit is double quotes around filter query.

这篇关于过滤器的 RESTHeart 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆