/**
学习笔记:nodejs操作mongodb
2021/4/6
*/
#nodejs操作mongodb
`
var mongodb = require('mongodb');
var server = new ('localhost', 27017, {auto_reconnect:true});
var db = new ('mydb', server, {safe:true});
oArray(function(err,docs){
('find');
(docs);
});
(function(err,doc){
('findOne');
(doc);
});
}
});
.');
oArray(function(err,docs){
(function(e){
;
});
});
*/
/*
//新增数据
var tmp1 = {username:'linjunjie',password:'810327'};
(tmp1,{safe:true},function(err, result){
(result);
});
*/
/*
// 删除数({username:'limingxia'},{safe:true},function(err,result){
(result);
据
});
*/
/*
//更新数据
({username:'linjunjie'}, function(err, result){
(result);
});
*/
/*
}
})
}else{
{$set:{username:'limingxia'}}, {safe:true},
(\"connect failed\");
}
});
*/`
因篇幅问题不能全部显示,请点此查看更多更全内容