MCPcopy Index your code
hub / github.com/simstudioai/sim / sanitizeCollectionName

Function sanitizeCollectionName

apps/sim/app/api/tools/mongodb/utils.ts:134–141  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

132}
133
134export 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

Callers 5

route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90
route.tsFile · 0.90

Calls 1

testMethod · 0.80

Tested by

no test coverage detected