How do I use a global variable in the same Mongodb script JS file
===

I have my JS file.
I have a variable declared at the top called:

var aCollection = db.myCollection;


I use this variable to refer to the collection. It's easy, since I can change the name of the collection to process another collection.

Now I want to use this in a function, like this:
fn1 = function(_id) {

    // use  _id and aCollection 

    // i get an error if I use "aCollection"
}

And I call the above function like this:

db.eval(fn1, "245");





