Simple Meteor app just doesn't work anymore


I have a little Meteor application as a pet project for autoformation. It used to work some versions ago. It doesn’t anymore. No errors. No traces. Nor server side, nor client side.

I have this simple code :smile:


// External dependencies
import { Mongo } from "meteor/mongo";

export const PlayersCollection = new Mongo.Collection("players");

PlayersCollection.getOfficialRankings = () => {
    Log("Getting official rankings")
    let result = PlayersCollection.find(
        { rank: { $gt: 0 } },
        { sort: { elo: -1 }, limit: 200 }
    return result;


    import MainTitle from './components/MainTitle.svelte';
    import Player from './components/Player.svelte';
    import {PlayersCollection} from '../api/PlayersCollection';

    $m : players = PlayersCollection.getOfficialRankings();
    Log("players ="+players);
    $m: sectionType = "byElo";

<div class="container">

    <div id="official">
        <table class="zigzag">
            <th class="header">#</th>
            <th class="header">Joueur</th>
            <th class="header">Rang</th>
            <th class="header">ELO</th>
            {#each players as player, i}
                <Player rank={i+1} player={player} section={sectionType} />


players is always empty.

There is a bot running server side using this PlayersCollection and it is working. The MongoDB connection seems ok.

Any clue ? It did work once with the same code !

I guess you need autopublish package.

The autopublish package is there. But I follow the idea and tried with publish/subscribe mechanism, same result. Collection is empty server side.

Have you tried running the equivalent find query on the meteor mongo CLI ? Maybe there are no records that match your criteria?

Another way you could debug is placing a debugger; line inside the getOfficialRankings function and running meteor with “–inspect”. Then you run the client and open the server side debug console in Chrome (so you get a chrome console attached to the server). Then you can play with your PlayersCollection and see exactly what your find statement is returning and what an empty find statement returns etc.

1 Like