【发布时间】:2016-04-20 23:43:46
【问题描述】:
目前我有一个订阅集合的模板:
Template.Actividades.onCreated(function(){
var self = this;
self.autorun(function(){
self.subscribe("recursos");
});
});
Template.Actividades.helpers({
recursos: function() {
return Recursos.find({clase: "Actividades"});
}
});
不幸的是,当我使用条件执行 find({}) 时,我仍然可以显示集合中的所有项目,而不仅仅是将“Actividades”作为“分类”的项目。
下面是与这部分相关的 Collection Schema:
RecursosSchema = new SimpleSchema({
clase: {
type: String,
label: "Clase",
allowedValues: ["Actividades", "Colegios", "Jardines"],
autoform: {
afFieldInput: {
firstOption: "(Selecciona una clase)"
}
}
},
问题是我在 find({}) 条件下做错了什么?
感谢您的帮助。
【问题讨论】:
-
您确定这是退回所有商品吗?转到您的浏览器控制台并运行这个确切的查询
Recursos.find({clase: "Actividades"}).fetch(),看看你得到了什么。
标签: javascript meteor meteor-blaze