2013-10-19 44 views
0

我從收藏我的代碼轉換爲SmartCollection:(在second.js這是最主要的js文件)切換到SmartCollection

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個集簡單initialiation:

Meteor.publish('testcases', function() { 
return Testcases.find({}); 
}); 
    Meteor.publish('backup', function() { 
     return Backup.find({}); 
}); 

回答

1

「未定義是不是一個函數」錯誤表明SmartCollection包沒有安裝。

確保您已按照安裝說明進行操作,如果是氣氛軟件包,請確保您使用'mrt'而不是'meteor'來運行您的應用程序。

+0

謝謝阿拉寧,我會試試這個。 – aladine