0

What am i doing wrong?

I'm building the leaderboard app from meteortips.com Trying to build a collection in the database this is my code:

new Meteor.Collection('players');
 PlayersList = new Meteor.Collection('players');
    if(Meteor.isClient) {
       console.log("Hello Client");
  }
   if(Meteor.isServer) {
      console.log("Hello Server");
   }

Trying out PlayersList on the js console gives me an error:

 PlayersList
    ReferenceError: PlayersList is not defined
  message: "PlayersList is not defined"

stack: (...) stack: function () { [native code] } set stack: function () { [native code] } proto: Error

MichaelM
  • 31
  • 5

2 Answers2

0

You’re defining the collection twice. Change:

new Meteor.Collection('players');
 PlayersList = new Meteor.Collection('players');

to just:

PlayersList = new Meteor.Collection('players');
Geoffrey Booth
  • 7,168
  • 5
  • 35
  • 42
0

you must to create the collection of follows way

PlayersList = new Meteor.Collection('players');

and you have to pay attention where you create this collection, because if you want have this collection in the two sides, client and server, you must create the collection in one archive outside of client and server folder. This collection you can use in all your application.

Walter Zalazar
  • 541
  • 4
  • 11