DAO (Data Access Object) Data access object is an object-oriented data access interface, data access: as the name implies is to deal with the database. It is sandwiched between business logic and database resources.
Module to encapsulate Node to access the database (DAO layer encapsulation)
External call
/* 引入封装数据库操作的模块 */
const db = require("封装数据库操作的模块");
/* db模块find方法调用 */
db.find({
"dbName": "dbName", // 数据库名
"collectionName": "collectionName", // 集合名
"json": {}, // 查询条件
"callback": function(err, result) {
res.send(result); // 查询结果
}
"pageAttr": {
"pageAmount":null, // 每页数据量
"page": null, // 第page页
},
"sort":{}, // 排序
});
From the above thought, the addition, deletion and modification of MongoDB are similar