MCPcopy Create free account
hub / github.com/NanmiCoder/MediaCrawler / find_many

Method find_many

database/mongodb_store_base.py:124–134  ·  view source on GitHub ↗

Query multiple records (limit=0 means no limit)

(self, collection_suffix: str, query: Dict, limit: int = 0)

Source from the content-addressed store, hash-verified

122 return None
123
124 async def find_many(self, collection_suffix: str, query: Dict, limit: int = 0) -> List[Dict]:
125 """Query multiple records (limit=0 means no limit)"""
126 try:
127 collection = await self.get_collection(collection_suffix)
128 cursor = collection.find(query)
129 if limit > 0:
130 cursor = cursor.limit(limit)
131 return await cursor.to_list(length=None)
132 except Exception as e:
133 utils.logger.error(f"[MongoDBStoreBase] Find many failed ({self.collection_prefix}_{collection_suffix}): {e}")
134 return []
135
136 async def create_index(self, collection_suffix: str, keys: List[tuple], unique: bool = False):
137 """Create index: keys=[("field", 1)]"""

Callers 1

testMethod · 0.95

Calls 1

get_collectionMethod · 0.95

Tested by 1

testMethod · 0.76