Node js exporting variables maintaining reference - Passing-by-reference?

Hey I just want to make sure I am not making a huge mistake with this. I am using Sequelize.js for a node.js project. I want to make sure that I am passing by reference and someone to please explain the concept and if there is a better way to do this.

var sequelize = new Sequelize(database, user, password);
exports.User = User = sequelize.import(__dirname + '/models/user');
exports.Comment = Comment = sequelize.import(__dirname + '/models/comment');

User.hasMany(Comment);
Comment.belongsTo(User);

// I dont want my code to look like this

exports.User.hasMany(exports.Comment);

I think what I am doing is referencing the same memory. So if somehow User was altered it would also alter the exports.User. Is that right?

The reason I am doing this is that I want to use the variable User in my models.js file to make it easier to do User.hasMany(Comments) etc... and also be able to export that same variable to the rest of my application. Any suggestions, warning, insights?

You're right, they're the same variable. However, this is bad because you don't have a "var" statement.

exports.User = User = sequelize.import(__dirname + '/models/user');

Do this instead.

var User = exports.User = sequelize.import(__dirname + '/models/user');

Also, you accidentally set User on the comment line.