6
在我的架構,如果我有options
在metrics : [ { options : {} } ]
然後我得到:奇怪的貓鼬schema.js錯誤 - `options`可能不被用作模式路徑
/home/one/cloudimageshare-monitoring/project/node_modules/mongoose/lib/schema.js:282
throw new Error("`" + path + "` may not be used as a schema pathname");
^
Error: `options` may not be used as a schema pathname
如果變化options
任何其他字...就像qoptions
....然後錯誤消失。這是爲什麼發生?
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var FilesystemSchema = new mongoose.Schema({
timeStamp : { type : Date, index: true },
avaiable : Boolean,
status : String,
metrics : [
{ options : {
data : String,
type : String,
unit : String
}
},
{ freeFiles : {
data : Number,
type : String,
unit : String
}
},
{ total : {
data : Number,
type : String,
unit : String
}
},
{ avail : {
data : Number,
type : String,
unit : String
}
},
{ free : {
data : Number,
type : String,
unit : String
}
},
{ files : {
data : Number,
type : String,
unit : String
}
},
{ used : {
data : Number,
type : String,
unit : String
}
}
]
});
module.exports = FilesystemSchema;