(name: string)
| 132 | } |
| 133 | |
| 134 | export function sanitizeCollectionName(name: string): string { |
| 135 | if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name)) { |
| 136 | throw new Error( |
| 137 | 'Invalid collection name. Must start with letter or underscore and contain only letters, numbers, and underscores.' |
| 138 | ) |
| 139 | } |
| 140 | return name |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * Introspect MongoDB to get databases, collections, and indexes |