I’d like to have a unique key in one of my collections. SimpleSchema has a way to specify this, but I’ve decided (for now at least) not to use SimpleSchema. What might be another way of having a unique index?
I was thinking I could just do something like this on the server-side, in the file that defines the collection (which runs on both client and server):
if (Meteor.isServer) {
collection.rawCollection().createIndex({ someKey: 1 }, { unique: true })
}
and then maybe I can catch that error somehow.