How to create unique items in RethinkDB

rethinkdb

Solution

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.

Problem

How to create unique items in RethinkDB? In MongoDb I used `ensureIndex` for this, eg: ``` userCollection.ensureIndex({email:1},{unique:true},function(err, indexName){ ```

Original source