Commit 7441fb7f by serpucga

Little bugfix that made single paged collections crash. Also, now code is more elegant

parent a4b15d31
......@@ -4,6 +4,7 @@ import json
import re
import time
import datetime
import math
import multiprocessing as mp
from math import ceil
from typing import List, Dict
......@@ -410,11 +411,7 @@ def get_page_index_fast(
"""
pages = []
first_page = collection.find()\
.sort("id", pymongo.DESCENDING)\
.limit(page_size)
pages.append(first_page[0]["id"])
last_id = first_page[page_size - 1]["id"]
last_id = math.inf
while True:
page = collection.find({"id": {"$lt": last_id}})\
.sort("id", pymongo.DESCENDING)\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment