mirror of
https://github.com/HKUDS/LightRAG.git
synced 2025-12-30 00:13:15 +00:00
Optimize node label retrieval with aggregation
- Enable allowDiskUse for large datasets
This commit is contained in:
parent
778ad4f23a
commit
c51079335e
@ -697,7 +697,12 @@ class MongoGraphStorage(BaseGraphStorage):
|
||||
[id1, id2, ...] # Alphabetically sorted id list
|
||||
"""
|
||||
|
||||
cursor = self.collection.find({}, projection={"_id": 1}, sort=[("_id", 1)])
|
||||
# Use aggregation with allowDiskUse for large datasets
|
||||
pipeline = [
|
||||
{"$project": {"_id": 1}},
|
||||
{"$sort": {"_id": 1}}
|
||||
]
|
||||
cursor = await self.collection.aggregate(pipeline, allowDiskUse=True)
|
||||
labels = []
|
||||
async for doc in cursor:
|
||||
labels.append(doc["_id"])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user