Cannot use browser console to view data - Meteor 1.3

I have simple template which renders on a specific route. It has a subscription of patient collection.Before 1.3 I could write any find().fetch() to view my subscription data. But in 1.3 i’m getting patient is not defined error.

note that, in the corresponding template js file, i’ve the template html file imported and also that patient collection along with schema imported.

Hi Faysal,

That isn’t the behaviour I’m seeing in 1.3 but without any code to look at i’d only be guessing about the course of your particular issue.

Send us a repo where the issue is observable and I’m sure a solution will present itself :wink:

Floyd Price
Meteor Casts @ https://floydprice.com

2 Likes

yap…some code or repo will help.

Any idea @serkandurusoy ?

His collections were defined inside the imports folder and were defined as export let CollectionName so no globals existed and as such the console couldn’t see them. To solve his immediate need to use the console to debug the collection, we attached the Patients collection to the window variable in the template onCreate helper method (window.Patients = Patients) this allowed Fysal to to temporarily use the console to debug the collection.

2 Likes

Thank you @floydprice for your in person help. Just to let all know for future references,

We cannot actually see our data through console straight forwardly unless we make some changes. Let’s say I have a collection Patients and if we want to see our data ( for debug purpose ), we need to do something like this

Template.templateName.onCreated(function(){ window.Patients = Patients; // Patients collection should be in the import list first. });

1 Like

I’d remove this when you are done debugging it, adds no actual value to your application user to have a Collection accessible to the console.

1 Like

thanks @floydprice eye opening !!!

Try in browser console or in terminal: @faysal
Meteor.Collection.get('patient').find().fetch()

3 Likes

I was also thinking the same way, earlier before the Meteor 1.3 when the imports directory isn’t introduced we generally put the collections in the common directory ( so that it’s available in server and client) both, but now with imports in place. So we now have to explicitly import the Collections on the client side, for minimongo to work ? is it so, or we have the client side collections either way ?
@floydprice @zahed