如何在CouchDB/Node.js中使用Cradle删除键/值对? [英] How do I delete a key-value pair using Cradle in CouchDB/Node.js?
问题描述
我一直在与CouchDB客户端Cradle合作.但是,我有一个填充有键值对的文档,并且试图删除其中的特定行.
I've been working a lot with Cradle, the couchDB client. However, I have a document filled with key-value pairs, and I'm trying to delete a specific row in there.
在文档中,我找不到一种不包括删除整个文档的删除方法文档或使用空值对其进行更新.谁能指出我正确的方向?我觉得这很可能是很多人遇到的一个非常简单的问题.
In the documentation, I cannot find a way to do deletion that doesn't include deleting the entire document or updating it with a null value. Can anyone point me in the right direction? I feel this is most likely a very simple issue that lots of people run into.
推荐答案
在CouchDB中,不支持部分文档更新(对此支持的讨论有时会进行,但由于没有公认的修补JSON的方法) ,它永远不会走得太远),因此您必须使用删除不需要的键/值对的副本来更新整个文档.
In CouchDB, there is no support for partial document updates (support for this is discussed every once in a while, but since there is no accepted way to patch JSON, it never gets very far), so you have to update the entire document with a copy where the unwanted key/value pair is removed.
这篇关于如何在CouchDB/Node.js中使用Cradle删除键/值对?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!