Cannot insert stuff into server side collection / cannot subscribe to collection

Hi everyone. I’m really struggling to fix something that should be incredibly simple. What I’m trying to do:

  1. App checks if a collection of pages is empty
  2. If it is, insert some placeholders into the collection
  3. Then generate links based on that collection and put them in the navbar

Couldn’t be simpler it’d seem and it actually worked up to some point. Now, however, stuff is not inserted into the server side collection. The pages collection remains empty (though it exists when I check in Mongo shell), so placeholders are inserted after each refresh, and links are put into the navbar (at least that works).

No clue what messed it up. I removed autopublish and insecure, but I’m relatively certain it still worked long after that. I added aldeed:simple-schema, that’s the most recent (major) change, though, again, I don’t think that broke it. I’m also using React Router, which also did not seem to break anything.

I’m suspecting my clean up efforts to be at fault. Initially, I had no real grasp of when to import what and where, so I imported everything everywhere, more or less. Then I began following the Meteor todos react tutorial and removed from my project whatever seemed excessive. Then I looked at the recommended app structure as well as the import hints and reshuffled some files and trimmed some more. Somewhere in this process, I’m guessing, I screwed up.

Now, I’m certain that I’d better off just remaking my thing from scratch or modifying the example todos app. However, it drives me up the wall that I can’t fix this, because I’ll be bound to make the same mistake again. I need to know.

Here’s the component in question:

https://github.com/PhilResch/twory_www_v4/blob/Adding-sample-data-and-styling/imports/ui/components/navigation.jsx

And here’s the collection and methods that it (somewhat) uses:

https://github.com/PhilResch/twory_www_v4/blob/Adding-sample-data-and-styling/imports/api/pagesCollection.js

Another thing I thought about is load order, but I think my project follows the recommended way quite closely. Anyway, seems to me that the insert method is not executed on the server side, though console.logs I put in server only code do work. Maybe something is wrong with the craeteContainer() bit in navigation.jsx:

export default createContainer(() => {
Meteor.subscribe(‘pagesCollection’);

return {
pagesCollection: PagesCollection.find({}).fetch(),
currentUser: Meteor.user(),
};
}, Navigation);

It doesn’t matter if I manually put stuff into the pagesCollection in the Mongo shell, the app seems not to subscribe to the server side collection, sticking with the client side one.

Anyway, I’m out of ideas and I’ll be incredibly grateful for anyone taking the time to look into this.

To all the good people taking time to look into this, if there are any, please stop. I managed to semi-fix this, and I’m still trying to wrap my head around what exactly was wrong.

The most obvious thing is the typo (three lowercase "L"s instead of two in collection name). However, fixing it did not solve much of my problems, but I appear to be overcoming the rest.

If I straighten this out, I’ll try to drop a note here for others who might bump into something similar.