Mongo collection and var

The documentation for using a mongo collection is as follows:

Chatrooms = new Mongo.Collection(“chatrooms”);

I just wonder that if that collection is only used within that server js file - would the following be better?

var Chatrooms = new Mongo.Collection(“chatrooms”);

My reasoning (but I could be totally wrong!) is that by using the var word you make the application more secure - the collection is only available in the one js file, and I also suspect it might be more memory efficient than having a global varable.

Yes, you can use var (or const, or let) if you want the collection to be accessible only from the js file where it is declared.
As for memory efficiency, I doubt this makes any difference.

The problem with this approach is that by using var, const, let you are scoping the collection to the file. That means that if (as is most likely) you intend using the collection on the client and server, you are constrained to distinguishing the context by means of Meteor.isClient and Meteor.isServer.

From a security perspective this is a bad idea, because all your code within a Meteor.isServer is sent to the client and may be inspected by anyone.

Thanks robfallows, I think I understand your point, thankfully the collections in questions are only supplying data to Meteors calls (Meteor.methods) and are not linked directly to the client.