2016-02-12 6 views
0

я получаю следующее сообщение об ошибке в моем meteor.js приложение я не знаю, что случилось было после урока делали каждый раз:Простая схема не работает

Вот мой код:

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); 

ошибка в терминале:

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

+0

У вас есть метеор, добавленный 'aldeed: collection2 @ 2.8.0'? Кроме того, пожалуйста, проверьте [справку по форматированию] (http://stackoverflow.com/help/formatting), ваш код не отформатирован должным образом. –

+0

да, я добавил collection2, мне даже пришлось установить aldeed: simple-schema, но ничего не работает. Извините за форматирование – sypher93

ответ

3

Вам нужно определить коллекцию с заглавной 'C':

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

Ваш читает Mongo.collection, так что вы получаете сообщение об ошибке undefined is not a function.

Смежные вопросы