2016-03-18 30 views
0

我不知道我必須做的,讓在這裏工作是代碼:只加1行代碼頂部

Songs = new Mongo.Collections("songs"); 

if (Meteor.isClient) { 
    // counter starts at 0 
    Session.setDefault('counter', 0); 

    Template.hello.helpers({ 
    counter: function() { 
     return Session.get('counter'); 
    } 
    }); 

    Template.hello.events({ 
    'click button': function() { 
    // increment the counter when button is clicked 
     Session.set('counter', Session.get('counter') + 1); 
    } 
    }); 
} 

if (Meteor.isServer) { 
    Meteor.startup(function() { 
    // code to run on server at startup 
    }); 
} 

這裏是錯誤: 類型錯誤:未定義不功能 at newapp.js:1:9

我所做的只是添加了1行。另外,我將如何在瀏覽器的Javascript控制檯中運行適當的Javascript代碼,以將項目插入到Songs集合中。 我是初學者。

回答

1

使用Mongo.Collection而不是Mongo.Collectionss在最後是沒有必要的。

+0

謝謝。對於愚蠢的問題抱歉。 –

+0

享受閱讀和學習流星:) –