Skip to content

Commit d901243

Browse files
authored
COMPASS-1868: Validate database names with '.' in them (#1341)
1 parent 6f0ba0f commit d901243

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/internal-plugins/database-ddl/lib/store/create-database-store.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ const CreateDatabaseStore = Reflux.createStore({
3131
* @param {Number} size - The max size of the capped collection.
3232
*/
3333
createDatabase(dbName, collection, capped, size) {
34+
if (dbName.includes('.')) {
35+
return this.handleResult(new Error('Database names may not contain a "."'), null);
36+
}
3437
const options = capped ? { capped: true, size: parseInt(size, 10) } : {};
3538
try {
3639
this.dataService.createCollection(`${dbName}.${collection}`, options, this.handleResult.bind(this));

0 commit comments

Comments
 (0)