fix: allow disk use for stats
This commit is contained in:
parent
685703ea12
commit
88bfa7796b
|
@ -1,6 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use chrono::{Duration, Utc};
|
||||
use mongodb::bson::{Document, doc};
|
||||
use mongodb::options::AggregateOptions;
|
||||
use tokio_stream::StreamExt;
|
||||
use crate::stats::Statistics;
|
||||
use crate::web::State;
|
||||
|
@ -125,7 +126,9 @@ pub async fn get_stats_seven_days(state: &State) -> Result<Statistics> {
|
|||
async fn get_stats_internal(state: &State, docs: impl IntoIterator<Item = Document>) -> Result<Statistics> {
|
||||
let mut cursor = state
|
||||
.collection()
|
||||
.aggregate(docs, None)
|
||||
.aggregate(docs, Some(AggregateOptions::builder()
|
||||
.allow_disk_use(true)
|
||||
.build()))
|
||||
.await?;
|
||||
let doc = cursor.try_next().await?;
|
||||
let doc = doc.ok_or_else(|| anyhow::anyhow!("missing document"))?;
|
||||
|
|
Loading…
Reference in New Issue