/**
学习笔记: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\");
}
});
*/`
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- huatuo0.com 版权所有 湘ICP备2023021991号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务