0

New to couchdb. I have a couchdb database, and then I have added users document to this database. I want to maintain uniqueness of both username AND email. If I had to check uniqueness of only one of those two fields I could use it directly as the _id value. But username or email address cannot have duplicate entries. How do I go about solving this?

Also, how does uniqueness work in a cluster scenario?

pewpewlasers
  • 3,025
  • 4
  • 31
  • 58
  • I doubt you can handle uniqueness on the server side without using the _id to control uniqueness. You will probably have to handle it on the client side or do some sort of proxy – Alexis Côté Oct 31 '16 at 21:01
  • 1
    As a suggestion, your kind of request fits better for relationnal databases. One thing you could do is to manage your user credentials/important informations in a relational database such as SQL and use CouchDB for your other informations. – Alexis Côté Nov 01 '16 at 15:15
  • Look at: http://stackoverflow.com/questions/1541239/unique-constraints-in-couchdb –  Nov 08 '16 at 19:35

0 Answers0