nodejs+mongoskin操作mongo
拓拔嘉颖
2023-12-01
var db = require('mongoskin').db('mongodb://localhost:27017/testdb');
/**
db.collection('task').find().toArray(function(err,result){
if(err){
console.log(err);
}
// console.log(result);
for(var a in result){
console.log(result[a].taskName);
}
});
**/
db.collection('task').update({taskName:'fuck'},{$set:{taskName:'fuck33'}},function(err){
if(err){
console.log(err);
}
console.log('success');
});