Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create unique items in RethinkDB

Tags:

rethinkdb

How to create unique items in RethinkDB?

In MongoDb I used ensureIndex for this, eg:

userCollection.ensureIndex({email:1},{unique:true},function(err, indexName){
like image 862
daslicht Avatar asked Jul 22 '13 13:07

daslicht


1 Answers

RethinkDB does not currently support uniqueness constraints on fields other than the primary key.

You could use an auxiliary table where the unique field is stored as the primary key in order to check for uniqueness in your application explicitly.

like image 114
Daniel Mewes Avatar answered Oct 01 '22 05:10

Daniel Mewes