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

Method find_one

database/mongodb_store_base.py:115–122  ·  view source on GitHub ↗

Query a single record

(self, collection_suffix: str, query: Dict)

Source from the content-addressed store, hash-verified

113 return False
114
115 async def find_one(self, collection_suffix: str, query: Dict) -> Optional[Dict]:
116 """Query a single record"""
117 try:
118 collection = await self.get_collection(collection_suffix)
119 return await collection.find_one(query)
120 except Exception as e:
121 utils.logger.error(f"[MongoDBStoreBase] Find one failed ({self.collection_prefix}_{collection_suffix}): {e}")
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)"""

Callers 1

testMethod · 0.95

Calls 1

get_collectionMethod · 0.95

Tested by 1

testMethod · 0.76