Not really a node question, but I think you're looking for mongo's loadServerScripts method:
https://docs.mongodb.org/manual/reference/method/db.loadServerScripts/#db.loadServerScripts On Tuesday, November 17, 2015 at 9:11:01 AM UTC-8, Soorya Prakash wrote: > > Hi, > I am having the js file stored in the /var/lib/mongodb/sever.js. The > server.js file has some predefined functions like below. > > db.system.js.save({ > _id: "abs", > value: function() { > xxxx; > } > }); > > How can I load these file like load("/var/lib/mongodb/server.js") from the > node js mongo db driver? > > db.eval("function(){ load('/var/lib/mongodb/server.js'); }", function(err, > result) { > console.log("The result of db creation ::::::::::::::::::::::::", > result); > console.log("The error on db creation :::::::::::::::::::::::", > err); > deferred.resolve(true); > }); > > I tried the above method but i am getting error as "load not defined". Is > there any way to achieve this? > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/97eddfe1-5472-4bd1-a9d8-1ea3cf1aa592%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
