登录完成
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
var MongoClient = require('mongodb').MongoClient;
|
||||
var dburl;
|
||||
let add = (set,data,url = dburl) =>{
|
||||
// console.log(url)
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true}, function(err, db) {
|
||||
if (err) throw err;
|
||||
@@ -99,7 +97,7 @@ let find = (set,where = {},page = 0,num = 0,url = dburl) =>{
|
||||
if (err) throw err;
|
||||
var dbo = db.db(url.dbname);
|
||||
try {
|
||||
dbo.collection(set). find(where).skip(num * page).limit(num).toArray(function(err, result) { // 返回集合中所有数据
|
||||
dbo.collection(set). find(where).skip(num * page).limit(num).toArray(function(err, result) {
|
||||
if (err) throw err;
|
||||
resolve({code:0,data:result});
|
||||
db.close();
|
||||
|
||||
Reference in New Issue
Block a user