我在cars文件夹中的cars.js中使用以下代码,
Cars = new Mongo.Collection('cars');
Cars.allow({
insert: function(userid, doc) {
return !!userid;
}
});
CarSchema = new SimpleSchema({
name: {
type: String,
label: "Cars"
},
desc: {
type: String,
label: "Car Condition"
},
author: {
type: String,
label: "Author",
autoValue: function() {
return this.userid
},
autoform: {
type: "hidden"
}
},
createdAt: {
type: Date,
label: "Created at",
autoValue: function() {
return new date()
},
autoform: {
type: "hidden"
}
}
});
Cars.attachSchema ( CarSchema );
这是quickform代码,
<template name="newcar">
<div class="new-car-container">
{{> quickForm collection="Cars" id="insertcarform" type="insert" class="new-car-form"}}
</div>
</template>
我看到一个表单UI但是当我去mongodb shell并显示集合时,我看不到我的收藏品名为&#39; cars&#39;那里。
P.S。我是一个非常新的编码器和学习者,请帮助我,如果可能的话,详细解释如何解决它。感谢