0

我正在尝试使用 RESTHear api 更新 MongoDB 文档中的一个键,但该值没有更新,但是,我得到了 200 OK。

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

http PUT "http://localhost:8080/presence/active_watchers?filter={'presentity_uri':'sip:service-1@opensipstest.org'}" event_id=12

http PATCH "http://localhost:8080/presence/active_watchers?filter={'presentity_uri':'sip:service-1@opensipstest.org'}" event_id=12

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

难道我做错了什么。我找不到任何例子。

我正在使用 Restheart v 2.0.0 Beta。

4

1 回答 1

2

要批量更新与过滤器表达式匹配的文档,请执行 http PATCH "http://localhost:8080/presence/active_watchers/*?filter={'presentity_uri':'sip:service-1@opensipstest.org'}" event_id=12

如果您 PUT/PATCH URI /presence/active_watchers,您实际上会更新集合属性(在 RESTHeart 数据库和集合中有自己的属性)。

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

请参阅文档表单中的资源 URI更多信息。

于 2016-04-04T08:05:59.120 回答