main_categories
にnull配列の値があります。 main_categories配列から_idキーを削除してください流行の単純なスキーマの問題
スキーマ定義
Schema.main_category = new SimpleSchema({
name: {type: String},
icon_image: {type: String},
description: {type: String}
});
Main_Category.attachSchema(Schema.main_category);
Schema.brand = new SimpleSchema({
name: {
type: String,
},
admin_number: {
type: String,
},
company_name: {
type: String,
},
owner_name: {
type: String,
},
owner_number: {
type: String,
},
admin_comment: {
type: String,
},
address: {
type: Schema.address,
},
logo_image: {
type: String
},
staffs: {
type: Array
},
"staffs.$": {
type: Object
},
"staffs.$.type": {
type: String,
allowedValues: ['admin']
},
"staffs.$.user_id": {
type: String
},
main_categories: {
type: [Schema.main_category]
},
sub_categories: {
type: [Schema.sub_category]
},
showcase: {
type: Boolean
}
});
Brand.attachSchema(Schema.brand);
実装
"addBrandMethod": function(jsonData) {
var json = {
name: jsonData.brandName,
admin_number: jsonData.adminNumber,
company_name: jsonData.companyName,
address: jsonData.companyAddress,
owner_name: jsonData.ownerName,
owner_number: jsonData.ownerNumber,
admin_comment: "jsonData.adminComment",
logo_image: "fasdfa",
staffs: [{
type: "admin",
user_id: "jaskjjkj"
}],
main_categories: [{
"_id": "uBibwEqaoDkZtXhsR",
"name": "Hair",
"icon_image": "nbdenck",
"description": "Hair Cut with Massage"
}
],
sub_categories: Sub_Category.find().fetch(),
showcase: true
};
Brand.insert(json);
return "Success";
}
'Schema.main_category'定義はどこにありますか? – chridam
Schema.main_category =新しいSimpleSchema({ 名:{ タイプ:文字列 }、 icon_image:{ タイプ:文字列 }、 説明:{ タイプ:文字列 }})。 Main_Category.attachSchema(Schema.main_category); –
あなたの質問に対する[編集]リンクを使用して、コメントではなく追加の情報を挿入してください。 – chridam