Tag: kraken.js

查询在使用mongoose.createConnection()与mongoose.connect()时挂起

作品: var mongoose = require('mongoose'); var db = function() { return { config: function(conf) { mongoose.connect('mongodb://' + conf.host + '/' + conf.database); var db = mongoose.connection; db.on('error', console.error.bind(console, 'connection error:')); db.once('open', function callback() { console.log('db connection open'); }); } }; }; module.exports = db(); 不起作用: var mongoose = require('mongoose'); var db = function() { return […]