异常: MongoError: cannot establish topology capabilities as driver is still in process of connecting
var mongodb = require('mongodb'); var db = new mongodb.Db('image_test', new mongodb.Server('127.0.0.1', 27017)); var ImageDB = { 'save_image': function(img, callback){ var gs = new mongodb.GridStore(db, name, 'w',{ 'content_type' : img.mimetype }); gs.open(function(err, gs){ gs.write(img.buffer, function(){ gs.close(function(err, result){ if(err){ console.log(err); }else{ console.log(result); } }); }); }); }, }
请问这何解,今天刚学node
已经解决了。。。原来还需要先open一下。。。明天再研究了
你好,能分享一下你的完整代码吗?