Bonjour,

Je débute avec l'appli leaderboard qui est dèja auto-configurée.
Lorsque je transfère le codage vers les trois piliers : /main.css /main.html /main.js
d'un autre projet vide , mongo n'est pas reconnu.

Console meteor mongo : un player est actif

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
meteor:PRIMARY> db.Players.find();
{ "_id" : ObjectId("5ed371b8d17447be23863859"), "name" : "David", "score" : 0 }
main.js :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Players = new Mongo.Collection("players");
...
// On server startup, create some players if the database is empty.
if (Meteor.isServer) {
    Meteor.startup(function() {
        if (Players.find().count() === 0) {
            var names = ["Ada Lovelace", "Grace Hopper", "Marie Curie",
                "Carl Friedrich Gauss", "Nikola Tesla", "Claude Shannon"
            ];
            _.each(names, function(name) {
                Players.insert({
                    name: name,
                    score: Math.floor(Random.fraction() * 10) * 5
                });
            });
        }
    });
}
Au démarrage, le niveau server de mongo ne démarre pas !

La console js ne donne pas d'erreur spécifique :
Exception in template helper: ReferenceError: Session is not defined
at Object.selectedName (http://localhost:3000/app/app.js?has...d1e7f92:109:36)
at http://localhost:3000/packages/blaze...b7ecda:2850:16
at http://localhost:3000/packages/blaze...b7ecda:1566:16
at http://localhost:3000/packages/blaze...b7ecda:2903:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze...b7ecda:3575:14)
at http://localhost:3000/packages/blaze...b7ecda:2902:27
at Object.Spacebars.call (http://localhost:3000/packages/space...3f294ec:172:18)
at Template.player.view (http://localhost:3000/app/app.js?has...ed1e7f92:40:22)
at Blaze.View.<anonymous> (http://localhost:3000/packages/blaze...b7ecda:2535:44)
at http://localhost:3000/packages/blaze...b7ecda:1778:18

Players.find().count();
0

Players.find().fetch();
[]length: 0__proto__: Array(0)

Players.find()
Cursor*{collection: LocalCollection, sorter: null, matcher: Matcher, _selectorId: undefined, skip: 0,*…}collection: LocalCollection*{name: "players", _docs: _IdMap, _observeQueue: M…r._SynchronousQueue, next_qid: 2, queries: {…},*…}fields: undefinedlimit: undefinedmatcher: Matcher*{_paths: {…}, _hasGeoQuery: false, _hasWhere: false, _isSimple: true, _matchingDocument: undefined,*…}reactive: trueskip: 0sorter: null_projectionFn: doc => {…}_selectorId: undefined_transform: null__proto__: Object