How to update single object with RESTHeart patch?

孤者浪人 提交于 2020-01-11 13:05:11

问题


I am using RESTHeart and MongoDB. I have multiple JSON objects and I want to update a particular object at a time with a REST call. I am following https://softinstigate.atlassian.net/wiki/spaces/RH/pages/9207882/Reference+sheet , But I am not able to update my object. patch call is not give me 200 ok status.

I am able to use patch, but I am not able to find out a particular object for the update.

Rh.one('db')
  .one('api')
  .patch(counter, {}, {})
  .then(function(response){

});

When I try some condition if-match in curly braces then I get this error:

412 (Precondition Failed) LIKE

Rh.one('db')
  .one('api')
  .patch(counter, {}, {"If-Match": index.name})
  .then(function(response){

});

I want to update particular object with patch.


回答1:


To update a document the URI needs to be /db/coll/<docid>

You are missing the document ID in the request URL.



来源:https://stackoverflow.com/questions/48111526/how-to-update-single-object-with-restheart-patch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!