如何使用RESTHeart补丁更新单个对象? [英] How to update single object with RESTHeart patch?

查看:71
本文介绍了如何使用RESTHeart补丁更新单个对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用RESTHeart和MongoDB.我有多个JSON对象,我想一次通过REST调用更新一个特定的对象. 我正在关注 https://softinstigate.atlassian.net/wiki /spaces/RH/pages/9207882/Reference + sheet ,但是我无法更新我的对象.补丁呼叫无法给我200好的状态.

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.

我可以使用 patch ,但是我无法找到用于更新的特定对象.

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){

});

当我在大括号中尝试某些条件 if-match 时,出现此错误:

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

412(前提条件失败) 喜欢

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

});

我想用补丁更新特定对象.

I want to update particular object with patch.

推荐答案

要更新文档,URI必须为/db/coll/<docid>

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

您在请求URL中缺少文档ID.

You are missing the document ID in the request URL.

这篇关于如何使用RESTHeart补丁更新单个对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆