Sails.js sails js-启动时清理集合时出错

Sails.js sails js-启动时清理集合时出错,sails.js,waterline,Sails.js,Waterline,在我的sails应用程序中,我编辑config/models.js文件如下,以在提升应用程序时清理数据库 migrate: 'drop', connection: 'mongodb' 但是当我尝试运行应用程序时,它会显示以下错误 A hook (`orm`) failed to load! error: Error (E_UNKNOWN) :: Encountered an unexpected error MongoError: Index with name: _id_ alrea

在我的sails应用程序中,我编辑config/models.js文件如下,以在提升应用程序时清理数据库

  migrate: 'drop',
  connection: 'mongodb'
但是当我尝试运行应用程序时,它会显示以下错误

A hook (`orm`) failed to load!
error: Error (E_UNKNOWN) :: Encountered an unexpected error
MongoError: Index with name: _id_ already exists with different options

我使用的是sails版本0.10.5,任何形式的帮助都将不胜感激。

同样,当您对模型有错误时,orm崩溃,至少您有错误,有时使用mysql时,您甚至没有错误。

问题是,在我添加到属性列表中的一些应用程序模型文件中

attributes: {
    _id: {
        type: 'string',
        unique: true
    }
}
由于我已将unique true添加到属性中,因此在启动时尝试清理集合时会导致错误。有关此问题的更多信息,请访问