2016-04-03 65 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。 –