Note, the Mojo DDB connection has been opened in the main All this application has been done for example only one DB. Now, if we are in the second Does anyone help me to know how it can be done with the original driver? You can write a cover, a new module where you store the DB example, this way Some of: Now, every time you need a DB example, do this: app.js file and the following Call it back to:
mongodb.connect ('MongoDBUrlGoesHere', function (mistake, db) {app.listen (app.get ('port'), function AppListnCB () {console .log ("listening server on port" + app.get ('port'));});});
external.js file and need the same
db object which is Elyady Connect. It can be done very easily if we are using or
// db.js var HOSTNAME = ... var port = ... var db = module.exports = {}; Var example; Db.connect = function () {... instance = & lt; Db_instance & gt ;; }; Db.disconnect = function () {... instance = null; }; Db.instance = function () {Return Example; };
No comments:
Post a Comment