Couchdb中的唯一约束 [英] Unique Constraint in Couchdb

查看:98
本文介绍了Couchdb中的唯一约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以在 couchdb 中应用唯一约束吗?

Is there any way to apply unique constraint in couchdb?

假设我有一个包含一些约束的文档诸如 email emp_id 电话号码之类的字段在整个文档中是唯一的。我找不到任何办法。有人知道如何实现这一目标吗?

Suppose I have a document which have some fields like email, emp_id, phone_number that needs to be unique throughout the document. I could not find any way. Anyone knows how to achieve this?

任何答案/建议都将不胜感激。

Any answer/suggestion would be appreciated.

推荐答案

经过大量搜索后,我发现如果只想向一个参数添加唯一约束,则可以将其设置为id。但是,如果有多个参数需要唯一,那么在couchdb中是不可能的

after a lot of searching, I found that If you want to add a unique constraint to only one parameter you can set it as id. But If there are multiple parameter that needs to be unique, then this is not possible in couchdb

这篇关于Couchdb中的唯一约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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