ES6 + global collection variables

When writing a pure ES6-Meteor app it can be hard to not have access to your collection variables in the global namespace when debugging on the client.

For example when you do:

import { Mongo } from 'meteor/mongo';

const Streams = new Mongo.Collection('streams');

export default Streams;

There is no way to do console.log(Streams.find().fetch()) in your browser console.

I made a simple NPM-module to fix this: https://github.com/TimBroddin/export-client

1 Like

I use the following technique

Meteor.default_connection._mongo_livedata_collections.users.find({}).fetch()

Just replace users with whatever collection you have.

That’s quite some typing, and there will be moment (2.0?) that Meteor won’t be available in the global namespace. But glad to know there is a way to access it :slight_smile: