router.get('/1',(ctx) => {
mongoClient.connect(url, function(err, client){
client.db("qq").collection("bb").find({}).toArray((err, users)=>{
ctx.body = users
console.log(users)
client.close()
})
})
})
ctx.body = users
router.get('/1', ctx => new Promise(resolve => {
mongoClient.connect(url, (err, client) => {
client.db("qq").collection("bb").find({}).toArray((err, users) => {
ctx.body = users;
console.log(users);
client.close();
resolve();
});
});
}));