简体   繁体   English

更新文档ouchdb

[英]updating a doc couchdb

Please bear with me if my question is simple, I'm so new to couchDB: 如果我的问题很简单,请耐心等待,我对bedDB很陌生:

I have this document: 我有这个文件:

{
   Name : Raju
   age : 23
   Designation : Designer
}

How can I update my document to: 如何将我的文档更新为:

{
   Name : Raju
   age : 23
}

Can I use insert for the document with my desired data which is {Name : Raju, age : 23} object? 我可以在文档中insert带有所需数据的文档,该数据是{Name : Raju, age : 23}对象吗? Does it delete Designation field? 它会删除“ Designation字段吗?

In short, you can do that, CouchDB does not attempt to merge updates, just updates the doc to whatever you sent it. 简而言之,您可以这样做,CouchDB不会尝试合并更新,而只是将文档更新为您发送的文档。 Please take a moment to read http://docs.couchdb.org/en/1.6.1/intro/api.html#documents It is a very simple, well written bunch of examples. 请花一点时间阅读http://docs.couchdb.org/en/1.6.1/intro/api.html#documents这是一个非常简单且写得很好的示例。 I would encourage you to read the couchdb docs first if you new to it. 如果您是初学者,我建议您先阅读该文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM