remove: function(dataname?? removelanguage?? dealdata) {
var server = new mongodb.Server(dataconfig.dataurl?? dataconfig.dataport?? {
auto_reconnect: true
}); // ????mongodb????
var db = new mongodb.Db(dataconfig.dataname?? server?? {
safe: true
});
db.open(function(err?? db) {
if (err) {
console.log('?????????');
} else {
db.createCollection(dataname?? {
safe: true
}?? function(err?? collection) {
if (err) {
console.log('????????????');
} else {
collection.remove(removelanguage?? {
safe: true
}?? function(err?? result) {
dealdata(result);
db.close();
});
}
})
}
})
db.on("close"?? function(err?? data) {
if (err) {
console.log("??????????");
}
console.log('???????????');
});
}??
/*
@remove  ??????????????
@dataname ?????????
@dealdata ???????????????????result????
*/
removeall: function(dataname?? dealdata) {
var server = new mongodb.Server(dataconfig.dataurl?? dataconfig.dataport?? {
auto_reconnect: true
}); // ????mongodb????
var db = new mongodb.Db(dataconfig.dataname?? server?? {
safe: true
});
db.open(function(err?? db) {
if (err) {
console.log('?????????');
} else {
db.createCollection(dataname?? {
safe: true
}?? function(err?? collection) {
if (err) {
console.log('????????????');
} else {
collection.remove({}?? {
safe: true
}?? function(err?? result) {
dealdata(result);
db.close();
});
}
})
}
})
db.on("close"?? function(err?? data) {
if (err) {
console.log("??????????");
}
console.log('???????????');
});
}
};
?????????????????????????
//????????
Mainpulation.select('test'?? {"title": "hello"}?? function(result) {
console.log("select??????");
console.log(result);
})
Mainpulation.insert('test'??{"insert":"hello"}??function(result){
console.log('inserts??????');
console.log(result);
})
Mainpulation.remove('test'??{"insert":"hello"}??function(result){
console.log(result);
})
Mainpulation.removeall('test'??function(result){
console.log(result);
})
Mainpulation.selectall('test'?? function(result) {
console.log('selectall??????');
console.log(result);
});
???????????????????????????????鵼????·??????????????
????module.exports = Mainpulation;