0
votes

I keep getting the following error in my meteor.js app i don't know whats wrong been following a tutorial did every exactly:

Here is my code:

Recepies = new Mongo.collection('recepies');

RecepieSchema = new SimpleSchema({
 name: {
    type: string,
    label: "Name"
  },
desc: {
    type: string,
    label: "Description"
   },
author: {
    type: string,
    label: "Author",
    autoValue: function () {
        return this.userId
    }
  },
createdAt: {
    type: date,
    label: "created At",
    autoValue: function () {
        return new Date()
     }
   }
  });
  Recepies.attachSchema( RecepieSchema);

The error in terminal:

Started MongoDB.
W20160212-14:38:03.572(2)? (STDERR)
W20160212-14:38:03.575(2)? (STDERR)/Users/sypher47/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245 W20160212-14:38:03.575(2)? (STDERR) throw(ex); W20160212-14:38:03.575(2)? (STDERR) ^ W20160212-14:38:03.575(2)? (STDERR) TypeError: undefined is not a function W20160212-14:38:03.575(2)? (STDERR) at collections/Recepies.js:1:12 W20160212-14:38:03.576(2)? (STDERR) at /Users/sypher47/recipes/.meteor/local/build/programs/server/app/collections/Recepies.js:39:4 W20160212-14:38:03.576(2)? (STDERR) at /Users/sypher47/recipes/.meteor/local/build/programs/server/boot.js:242:10 W20160212-14:38:03.576(2)? (STDERR) at Array.forEach (native) W20160212-14:38:03.576(2)? (STDERR) at Function..each..forEach (/Users/sypher47/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11) W20160212-14:38:03.576(2)? (STDERR) at /Users/sypher47/recipes/.meteor/local/build/programs/server/boot.js:137:5 => Exited with code: 8

1
Have you meteor added aldeed:[email protected]? Also, please check the formatting help, your code is not properly formatted. - Kyll
yes i have added collection2 i even had to install aldeed:simple-schema but nothing seems to be working. Sorry about the formatting - sypher93

1 Answers

3
votes

You need to define the collection with an uppercase 'C':

Recepies = new Mongo.Collection('recepies');

Yours reads Mongo.collection so you are getting an undefined is not a function error.