如何在java程序中的couchdb中执行更新操作 [英] how to execute update operation in couchdb in java programme

查看:205
本文介绍了如何在java程序中的couchdb中执行更新操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我正在使用couchdb进行存储.我想执行必须更改_rev值的更新操作.所以请帮我在Java程序中必须做的事情.

In my application I am using couchdb for storage. I want to execute update operation in which the _rev value must be change. so kindly help me what i have to do in my java program.

推荐答案

读取,修改和保存文档的代码为:

The code for reading, modifying and then saving a document is:

Document doc = db.getDocument("documentid1234");
doc.put("foo","bar");
db.saveDocument(doc);

doc对象将包含通过getDocument()调用读取文档后的_rev.

The doc object will contain the _rev from when the document was read with the getDocument() call.

您不生成_rev值,而是沙发生成.

You don't generate the _rev value, couch does.

这篇关于如何在java程序中的couchdb中执行更新操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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