Meteor 1.3 Importing / Exporting Collections

Tried your example, copy pasted it literally, here is the result:

And I have no idea what _items2 means.
I’m starting to think the issue is with the base repo I’m using,

Made an new project with 1.3 beta 8, and set it up in 2 minutes… Works great :confused: I’m not sure what you’re doing wrong

Hello again,
could I please trouble you to try your method using ? I forgot to mention that I’m using this as a starter project and I’m beginning to think the problem lies with this repo.

Can you make a repo that reproduce your problem? It’ll be easier for us to identify the cause of the error with a repo.


Actually the error thrown by your first code snippet is totally unrelated and different from your provided repo. In your first code snippet, you didn’t import Test on top of your client.js. That’s why you get the error Test reference is not defined.

For your repo, you got a syntax error in your items.js


Note the missing bracket after find. It should be like this


Thank you. Although by now I am totally confused about Meteor. Better to start again from scratch.
Good day to you.

I agree you’d gain a lot more from starting with an empty project, and working your way up from there :sunny: I’ve never used these boilerplates - but I guess they make sense if you want to save time.

try to use the meteor guide & the docs as much as you can - These are great resources!

what are you confused about?

Well for one your solution makes it hard to access a collection. When learning Meteor, I learned that once subscribed, a collection could be accessed from any file (provided it ran in the client), your solution makes that yes, data is displayed, but when I try to access it from the console in the browser, I still just get a measly Reference not Defined.

But I think that the issue really stems from the repo, given that any other example I’ve tried works flawlessly. I’ve been going over the starter code but I haven’t been able to find what ticks, and at this point I’m just too frustrated to continue. What I truly needed to begin with was a starter project using React and Material-ui and just enough organized code to get me started.

I’ll follow your advice, take it again from scratch and start on solid foundation this time.
Again, thank you for taking the time.

hehe, I understand the handiness of accessing collections from the console, but this is just not an option with 1.3 if you export your collections - with modules, your not exposing your exports to the global namespace - which means they’re not accessible in the console :slightly_smiling: but they’re definitely accessible anywhere - just remember to import dependencies!

1.3 is still in beta for ~a month, so the guidelines for it isn’t in the docs nor the guide yet, but it’s coming…


Now I wish I could kidnap you for a month so you could teach me ^^’

1 Like

If you are using modules. Then you are going to one accords this issue.
Bare in mind if you are importing something in the server code. And trying
to access the module on the desktop you’ll get the same error. If you are
fresh with meteor. And do not have previous experience with modules or even
es6 for that matter id strongly recommend starting with meteor and disable

1 Like

And how would I do that?

I would try doing one of the tutorials, here is the React one - The todo app in it is not a bad starter project.

The Meteor Guide is pretty awesome too -

Make sure you’re using Meteor 1.2.x

$ meteor remove modules

Nice idea @rwatts. Two questions regarding this:

  1. Is it normal not to see “modules” in the package file in the .meteor folder? I’m in 1.3 and I can’t find it.
  2. is such a removal safe? If it’s ok, I’ll follow your precious advice, waiting for @goatic guidelines though :slight_smile:

The removal is completely fine. For instance if you have packaged
installed that are depending on the modules package. Then they’re package
config file has its own set of instructions for loading and using modules.

However the only time removing modules would be a bad idea is if you’ve
already started writing your project using modular syntax.

Note the ecmascript package includes the modules package as a weak

What this mean is it is not a requirement to use modules with ecmascript.
But it may be assumed that most people would want both. So loading it as a
weak dependency for the latter package would be the reason. You don’t see
it I the packages file.

Running meteor remove modules will still remove the weak dependency
though. Also not weak dependency typically do not appear in the packages
folder unless another package has requested it as a true dependency and not
a weak one. .

1 Like

Thank you very much @rwatts!

This is my first time trying meteor and I am following : I am keep getting module not found. I am following the collection tutoriel not sure what am i doing wrong? Please help

–> you have a typo: you importet “imports/api/tasks.js”, but the file is named “task.js”