Unique property of the Sails.js model does not work in env production

I am new to sails and have been following a simple tutorial on creating a REST api. I 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 several unique fields. I tested this locally, using both localDisk sails and a real mongo database working locally, and everything works, that is, when I try to add a duplicate, he rejected it.

heroku MongoLab Redis. , , , . URL- , , , .

'sails-mongo'. -, prod ?

Alex

+4

Source: https://habr.com/ru/post/1569553/


All Articles