I am fairly new to sails and have followed a simple tutorial to create a REST api. I have created a model:
module.exports = {
schema: true,
attributes: {
name: {
type: "string",
unique: true,
required: true
},
role: {
type: "string",
required: true
},
group: {
type: "string",
required: true
},
email: {
type: "string",
unique: true,
required: true
},
telephoneNumber1: {
type: "string",
required: true
},
telephoneNumber2: {
type: "string",
}
}
};
The model contains some unique fields. I tested this out locally using both the sails localDisk and a real mongo DB running locally and everything was working i.e. when trying to add a duplicate it was rejecting it.
I then deployed to heroku and put in all the heroku config for the MongoLab and Redis. When testing I found that I could view all the entries using the index endpoint that I had created and I could also create new documents using the create endpoint. I then added a duplicate entry to the DB through the create url and found that it was allowing it and I was ending up with a load of documents that were identical.
I am using the 'sails-mongo'
adapter. Is there something I need to do with the prod DB to apply the rules?
Thanks Alex