How to update single object with RESTHeart patch?

2019-03-06 15:36发布

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条回答
成全新的幸福
2楼-- · 2019-03-06 16:04

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

You are missing the document ID in the request URL.

查看更多
登录 后发表回答