2016-04-03 62 views
0

我想使用RESTHear API更新MongoDB文档中的一个键,但该值没有得到更新,但是,我得到200 OK。RESTHeart PATCH没有更新文件

我试过PATCH和PUT两者。以下是我尝试的URI。

http PUT "http://localhost:8080/presence/active_watchers?filter={'presentity_uri':'sip:[email protected]'}" event_id=12 

http PATCH "http://localhost:8080/presence/active_watchers?filter={'presentity_uri':'sip:[email protected]'}" event_id=12 

两次我得到200 OK响应但没有更新的值。

我做错了什么。我找不到任何这样的例子。

我正在使用Restheart v 2.0.0测试版。

回答

2

匹配过滤器表达式批量更新文件做 http PATCH "http://localhost:8080/presence/active_watchers/*?filter={'presentity_uri':'sip:[email protected]'}" event_id=12

如果PUT/PATCH的URI /presence/active_watchers你居然更新集合属性(RESTHeart DBS和收藏有自己的属性)。

要更新文件,您需要提供的文件URI /db/coll/docid和批量更新,你可以使用通配符/db/coll/*?filter=[filter expression]

看到文档形式的更多信息Resource URI

+0

可以看到这个问题https://stackoverflow.com/questions/48111526/how-to-update-single-object-with-restheart-patch。 –