Unique Constraint in Couchdb

非 Y 不嫁゛ 提交于 2020-01-06 07:43:09

问题


Is there any way to apply unique constraint in couchdb?

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.


回答1:


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




回答2:


The only unique constraint in CouchDB is on the document ID. If you can put the unique components of your data in the document ID, then you have a uniqueness constraint.



来源:https://stackoverflow.com/questions/50000844/unique-constraint-in-couchdb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!