我想将归档的“行”定义为可以是不同类型的值数组(数字或字符串或布尔值或日期)
当我尝试时:
lines: [
{
type: String,
content: Mixed
}
Run Code Online (Sandbox Code Playgroud)
]
我收到 ESLint 错误错误:未定义混合
我应该写吗?
const Schema = mongoose.Schema;
...
lines: [
Schema.Types.Mixed
]
Run Code Online (Sandbox Code Playgroud)
根据 mongoose文档,您可以使用混合模式类型,如下所示
var schema = new Schema({
ofMixed: [Schema.Types.Mixed],
})
// example use
var Thing = mongoose.model('Thing', schema);
m.ofMixed = [1, [], 'three', { four: 5 }];
m.save(callback);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
18154 次 |
最近记录: |