我将我的代码从 Collection 转换为 SmartCollection:(在 second.js 中,这是主 js 文件)
Testcases = new Meteor.Collection('testcases');
Backup = new Meteor.Collection('backup');
进入 :
Testcases = new Meteor.SmartCollection('testcases');
Backup = new Meteor.SmartCollection('backup');
应用切换后出现此错误:
W2042-21:55:27.312(8)? (STDERR) /Users/dan/Documents/js_app/second/.meteor/local/build/programs/server/boot.js:185
W2042-21:55:27.313(8)? (STDERR) }).run();
W2042-21:55:27.313(8)? (STDERR) ^
W2042-21:55:27.315(8)? (STDERR) TypeError: undefined is not a function
W2042-21:55:27.315(8)? (STDERR) at app/second.js:1:49
W2042-21:55:27.316(8)? (STDERR) at app/second.js:10:3
W2042-21:55:27.316(8)? (STDERR) at /Users/dan/Documents/js_app/second/.meteor/local/build/programs/server/boot.js:154:10
W2042-21:55:27.316(8)? (STDERR) at Array.forEach (native)
W2042-21:55:27.317(8)? (STDERR) at Function._.each._.forEach (/Users/dan/.meteor/tools/a80b2d5689/lib/node_modules/underscore/underscore.js:79:11)
W2042-21:55:27.317(8)? (STDERR) at /Users/dan/Documents/js_app/second/.meteor/local/build/programs/server/boot.js:81:5
我需要更新什么吗。鉴于在服务器 js 代码中,我只实现了 2 个集合的简单初始化:
Meteor.publish('testcases', function() {
return Testcases.find({});
});
Meteor.publish('backup', function() {
return Backup.find({});
});