我正在构建一个新的Sails 1.0.2应用程序,该应用程序正在访问以前使用Sails 0.12应用程序创建的MongoDB数据库中的数据。每当我尝试从Sails 1.0.2应用程序访问数据时,都会收到有关使用旧应用程序创建的所有datetime
字段的警告。
在Sails 0.12应用程序中,我具有如下模型属性:
softExpiry: { type: 'datetime', defaultsTo: null }
在Sails 1.0.2应用程序中,我将该属性修改为:
softExpiry: { type: 'string', columnType: 'datetime', allowNull: true },
但是,我收到以下警告:
server_1 | Warning: After transforming columnNames back to attribute names for model `tokens`,
server_1 | a record in the result has a value with an unexpected data type for property `softExpiry`.
server_1 | The corresponding attribute declares `type: 'string'` but instead
server_1 | of that, the actual value is:
server_1 | ```
server_1 | 2018-03-26T17:49:59.000Z
server_1 | ```
我正在使用sails-mongo 1.0.1。我似乎找不到任何文档可以帮助我解决此问题。我只找到this StackOverflow thread,但它似乎仅适用于MySQL数据库,对我没有帮助。我该如何解决?