I use sails-mongo for working with models, I have a few attr with unique: true, but recently, this option does not work in the bug tracker said that it is necessary to add yourself this unique option, and then run using the migrate: safe. But I do not know how to mongo independently assign this option to automatically add and check. Tell me what to do to fix it?
Connect to your mongodb (e.g. with mongo-console).
Use this:
db.YOURCOLLECTION.ensureIndex( { YOURFIELD: 1 }, { unique: true } );