4

Sometimes I see that my database is empty, but I don't remove anything.

I am using Sails with MongoDB and I don't know why this is happening.

Community
  • 1
  • 1
oihi08
  • 737
  • 1
  • 6
  • 20

1 Answers1

1

it really depend on ./config/models.js file.

module.exports.models = {

  /***************************************************************************
  *                                                                          *
  * Your app's default connection. i.e. the name of one of your app's        *
  * connections (see `config/connections.js`)                                *
  *                                                                          *
  ***************************************************************************/
  //connection: 'localMysqlServer',

  /***************************************************************************
  *                                                                          *
  * How and whether Sails will attempt to automatically rebuild the          *
  * tables/collections/etc. in your schema.                                  *
  *                                                                          *
  * See http://sailsjs.org/#/documentation/concepts/ORM/model-settings.html  *
  *                                                                          *
  ***************************************************************************/
  migrate: 'alter',
  schema : true,
  autoPK: true,
  autoCreatedAt: true,
  autoUpdatedAt: true

};

migrate key is very important and make sure in production it set to 'safe' then it not modify the data of database.