在Cloudant DB上使用NodeJS更新和删除文档 [英] Updating and Deleting documents using NodeJS on Cloudant DB

查看:62
本文介绍了在Cloudant DB上使用NodeJS更新和删除文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使用HTTP / REST API成功查询(选择)并将数据插入Cloudant数据库。但是我不知道-如何删除和修改文档。

I was able to successfully query(select) and insert data into Cloudant database using HTTP /REST API. But I am not able to figure out - how to delete and modify documents.

要删除:我在nodejs
path中尝试了以下代码:'/ quick_loan_nosql_db_1?951b05d1b6aa100f4b94e5185674ef40 / _rev = 1-88963c755157188​​091f0d30115de18ce' REST API请求的
部分,方法为:DELETE。
但是执行该操作时,它会删除整个数据库而不是指定ID。

For Delete: I tried the following code in nodejs path : '/quick_loan_nosql_db_1?951b05d1b6aa100f4b94e5185674ef40/_rev=1-88963c755157188091f0d30115de18ce' part of the REST API Request with METHOD: DELETE. But when I execute it deletes the entire database instead of the ID being specified.

用于更新:有人可以提供一个吗?示例,我尝试使用PUT,但作为响应,我收到了冲突数据错误。
任何输入将不胜感激。

For Update: Can some one provide a sample, I tried with PUT, but in response I got a Conflict data error. Any input would be appreciated.

推荐答案

很好!要回答您的原始问题,只需输入 /和?在错误的地方。回顾一下:

Nice! To answer your original question, you just have the "/" and the "?" in the wrong places. To recap:

/ quick_loan_nosql_db_1?951b05d1b6aa100f4b94e5185674ef40 / _rev = 1-88963c755157188​​091f0d30115de18ce

应该 为:

/ quick_loan_nosql_db_1 / 951b05d1b6aa100f4b94e5185674ef40?_rev = 1-88963c755157188​​091f0d30115de18ce

这篇关于在Cloudant DB上使用NodeJS更新和删除文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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