I use node-mongodb-native in my project and I need to load some JavaScript file with my custom functions like in the following tutorial
My code for connecting to database looks like the following:
var mongoClient = new MongoClient(new Server('localhost', 27017, {
socketOptions: {keepAlive: 1}
, auto_reconnect: true
, poolSize: 10
}),
{
native_parser: true
, w:1
});
mongoClient.open(function (err, mongoClient) {
if (err) return callback(err);
var db = mongoClient.db('test');
console.log('Database connect success!');
// ... application code
});
I need to load underscore.js file into mongodb to be possible use it functions inside server-side functions saved by using db.system.js.save
I can't find a way of doing that. Please help me.