Using 'Competitions' as a global variable is not working

I have a collection called ‘competitions’ and I have assigned it to the global variable ‘Competitions’ but each time I attempt to retrieve data from the Mongo collection, I receive console errors such as Competitions.findOne is not a function and Competitions.find is not a function. This crashes my app.

To help debug the issue, I changed the global variable to something such as Comps and now I don’t receive these errors. Could someone please explain to me why it seems Competitions is some sort of reserved word or am I missing something?

Much appreciated.

Sounds like perhaps a typo when you declared it or you didn’t declare the client side collection or overwrote it or it isn’t a Mongo.Collection object. This is as good as it’ll get until we see some code :slight_smile:

Competitions isn’t a reserved word.

1 Like

Yes, thanks @mordrax. I went over your possibilities and it turns out it was a simple mistake. I had the same global variable name as one of my React components. Cheers for the help.