【发布时间】:2016-03-05 08:34:37
【问题描述】:
我的流星收藏没有显示。我不明白为什么。我已经创建了我的收藏,然后从终端插入了一些记录 像 : db.tasks.insert({ text: "Hello world!", createdAt: new Date() });
这是我的代码:
HTML/
<head>
<title>bdn</title>
</head>
<body>
<h1>Welcome to Meteor!</h1>
<ul>
{{#each tasks}}
{{text}}
{{/each}}
</ul>
</body>
<template name="Tasks">
{{text}}
</template>
MAIN.JS
Tasks = new Mongo.Collection("tasks");
if (Meteor.isClient) {
// This code only runs on the client
Template.Tasks.helpers({
tasks: function () {
return Tasks.find({});
}
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}
【问题讨论】:
标签: mongodb meteor collections