aladine
aladine

Reputation: 983

Switch from Collection to SmartCollection

I convert my code from Collection to SmartCollection: (in second.js which is the main js file)

 Testcases = new Meteor.Collection('testcases');
 Backup = new Meteor.Collection('backup');

into :

Testcases = new Meteor.SmartCollection('testcases');
 Backup = new Meteor.SmartCollection('backup');

The app got this error after switching:

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

Do I need to update anything. Given the fact that in server js code, I only implemented simple initialiation of 2 collections:

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

Upvotes: 0

Views: 100

Answers (1)

alanning
alanning

Reputation: 5217

The "undefined is not a function" error indicates that the SmartCollection package isn't installed.

Make sure you've followed the installation instructions and if it is an atmosphere package, make sure you run your app with 'mrt' rather than 'meteor'.

Upvotes: 1

Related Questions