Create index: keys=[("field", 1)]
(self, collection_suffix: str, keys: List[tuple], unique: bool = False)
| 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}") |