流星
问题描述:
即使我成功升级到最新的流星后,我仍然会收到此错误。谁能帮忙?流星<Object>没有方法'订阅'。关于最新的流星更新
W20141002-17:08:01.669(-5)? (STDERR)
W20141002-17:08:01.841(-5)? (STDERR) /Users/erikbigelow/.meteor/packages/meteor-tool/.1.0.33.kundj5++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141002-17:08:01.842(-5)? (STDERR) throw(ex);
W20141002-17:08:01.842(-5)? (STDERR) ^
W20141002-17:08:01.843(-5)? (STDERR) TypeError: Object #<Object> has no method 'subscribe'
W20141002-17:08:01.843(-5)? (STDERR) at app/main.js:1:43
W20141002-17:08:01.843(-5)? (STDERR) at app/main.js:3:3
W20141002-17:08:01.844(-5)? (STDERR) at /Users/erikbigelow/Sites/scenewith/.meteor/local/build/programs/server/boot.js:168:10
W20141002-17:08:01.844(-5)? (STDERR) at Array.forEach (native)
W20141002-17:08:01.845(-5)? (STDERR) at Function._.each._.forEach (/Users/erikbigelow/.meteor/packages/meteor-tool/.1.0.33.kundj5++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141002-17:08:01.845(-5)? (STDERR) at /Users/erikbigelow/Sites/scenewith/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
这是直接后我除去自动发布,并加入以下
服务器/ publications.js:
Meteor.publish('scenes', function() {
return Scenes.find();
});
main.js
Meteor.subscribe('scenes');
集合/scenes.js
Scenes = new Meteor.Collection('scenes');
答
从它看起来像你试图调用Meteor.subscribe
服务器上的日志,或至少不只是在客户端。
您的呼叫需要位于客户端文件夹或Meteor.isClient
块中,因为它的编号为client only method,因此它不会附加到服务器上的Meteor对象。
答
我不知道你一直使用的是什么版本的流星,但现在你定义的集合为:
myCollection = new Mongo.Collection('mycollection');
+0
谢谢我没有意识到这一点。我会阅读这些变化。 – 2014-10-03 00:22:02
UGH!你是对的,它在我的客户端文件夹之外,我没有看到。 – 2014-10-03 00:21:23