mirror of
https://github.com/YMFE/yapi.git
synced 2025-03-31 14:50:26 +08:00
fix aggregate(xx).cursor({}).exec().toArray() is not function
This commit is contained in:
parent
3ed74da12c
commit
2ac288a8d4
@ -35,10 +35,11 @@ class statisMockModel extends baseModel {
|
||||
return this.model.countDocuments({});
|
||||
}
|
||||
|
||||
getDayCount(timeInterval) {
|
||||
async getDayCount(timeInterval) {
|
||||
let end = timeInterval[1];
|
||||
let start = timeInterval[0];
|
||||
return this.model.aggregate([
|
||||
let data = [];
|
||||
const cursor = this.model.aggregate([
|
||||
{
|
||||
$match: {
|
||||
date: { $gt: start, $lte: end }
|
||||
@ -53,8 +54,11 @@ class statisMockModel extends baseModel {
|
||||
{
|
||||
$sort: { _id: 1 }
|
||||
}
|
||||
]).cursor({}).exec().toArray();
|
||||
}
|
||||
]).cursor({}).exec();
|
||||
await cursor.eachAsync(doc => data.push(doc));
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
list() {
|
||||
return this.model.find({}).select('date').exec();
|
||||
|
Loading…
x
Reference in New Issue
Block a user