【发布时间】:2019-01-10 05:30:10
【问题描述】:
我正在发现 moteor.js,但我在基础知识方面遇到了困难。到目前为止,我只是按照教程进行操作,一切都很好,直到我进入 Collections 部分。我的应用程序正在运行,mongod 正在运行,但由于某种原因,应用程序在此行崩溃
Tasks = new Mongo.Collection("tasks");
if (Meteor.isClient) {
Template.hello.greeting = function () {
return "Welcome to hannibal.";
};
Template.hello.events({
'click input' : function () {
if (typeof console !== 'undefined')
console.log("You pressed the button");
}
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
});
}
当我在 localhost:3000 打开页面时,我收到此消息
ReferenceError: Mongo is not defined
at app/hannibal.js:1:28
知道为什么要这样做吗?我认为这可能是因为我在 Windows 上使用了流星。
【问题讨论】:
-
你能发布更多你的代码吗?你在关注什么教程?网址?
-
windows版本支持什么meteor版本?
Mongo.Collection有点新,在 0.9.1 之前你必须使用Meteor.Collection。 -
我正在关注本教程:meteor.com/try/3