0

我正在寻找 couchdb 中主键功能的解决方法。我正在将 json 格式的文档保存到外部的 couchdb 中。有没有简单的方法来检查特定字段的值是否存在?

4

2 回答 2

0

If you try to save a document that already exists, it will be rejected unless the revision is set to match the existing revision.

Alternately, you can just try to fetch the document, either with GET or HEAD, to check if it exists. See the relevant documentation.

于 2018-05-01T13:34:51.800 回答
0

您可以在创建文档之前执行芒果查询,但它不能保证另一个进程在检查和创建之间创建文档。

这篇文章讨论了同样的问题:

在 CouchDB/Cloudant 中创建新文档之前如何检查重复?

于 2018-05-02T11:06:44.907 回答