Issue with Mongo.Collection subclassing after updating to 1.4.2

Hello everyone!

I’m a bit appalled by this issue:

Prior to updating, everything was working fine of course. But after updating to 1.4.2, I had to wrap all of my mat33:meteor-collection-hooks (which are all in my /imports/api/COLLECTION/methods.js file) in Meteor.isServer blocks for the app to start since after/before were undefined on the client (which didn’t happen before) and the app was throwing an error. Then the app loaded fine, but now I have no Collections on the client. Meteor Toys show only meteor.users and the three collections defined using ostrio:files. Publications work fine. When I console.log any of my collections, it just shows:

I have tried and got no solution:

  • Importing my collections in imports/startup/client/index.js instead of just on the imports/startup/server/register-api.js file.
  • Importing them in the startup/both/index.js file (where the ostrio/files collections are imported and do show in Meteor Toys)

Also, which might be useful information, my aldeed:tabular tables have no info either and their collection object shows the same as the image above.

I’m thinking its a load-order issue, but I can’t see where it is, and since I’m using the project structure recommended in the Meteor Guide, and did nothing else but update to 1.4.2, thought I might ask here for advice. Maybe something has changed and I need to update my folder structure or import order?

Has anyone had a similar problem, even if not with 1.4.2? Any advice?


Update: So, I made these changes and it solved the incomplete collection on client problem:

// Before, subclassing Mongo
class ProjectsCollection extends Mongo.Collection {
  ...
}
const Projects = new ProjectsCollection('projects');

// After, without subclassing Mongo
const Projets = new Mongo.Collection('projects')

I’m extending Mongo.Collection to do some changes before the mongo insert/update methods. (I realize its kind of redundant with the collection-hooks package, but I hadn’t completely updated that part of the code). With the changes, the Collection shows fine on the client and Meteor Toys and I have my data back on the tabular tables and on normal subscriptions.

So the new question is… What could be causing the subclassing issue?


Update 2: This seems to be related to this: [1.4.2-rc.4] super does not work in some cases because __proto__ is not set · Issue #7956 · meteor/meteor · GitHub which will be fixed on 1.4.2.1 :slight_smile: So, let’s wait for that. Was digging the shorter builds haha.

1 Like