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

Method create_index

database/mongodb_store_base.py:136–143  ·  view source on GitHub ↗

Create index: keys=[("field", 1)]

(self, collection_suffix: str, keys: List[tuple], unique: bool = False)

Source from the content-addressed store, hash-verified

134 return []
135
136 async def create_index(self, collection_suffix: str, keys: List[tuple], unique: bool = False):
137 """Create index: keys=[("field", 1)]"""
138 try:
139 collection = await self.get_collection(collection_suffix)
140 await collection.create_index(keys, unique=unique)
141 utils.logger.info(f"[MongoDBStoreBase] Index created on {self.collection_prefix}_{collection_suffix}")
142 except Exception as e:
143 utils.logger.error(f"[MongoDBStoreBase] Create index failed: {e}")

Callers 1

testMethod · 0.95

Calls 1

get_collectionMethod · 0.95

Tested by 1

testMethod · 0.76