-
Notifications
You must be signed in to change notification settings - Fork 233
feat(database-model,databases-collections,collection-model): hide system DBs COMPASS-9674 #7324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
02ad79b
a502af8
8479bcc
240417d
9ade683
e190a5b
6278c3e
8a982ad
96a07c7
ece5963
3551be2
3a58b70
ba6fa9f
8e44cbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -9,6 +9,10 @@ import toNS from 'mongodb-ns'; | |||||||||||||||||||||||||||||
* No dots in DB name error message. | ||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||
export const NO_DOT = 'Database names may not contain a "."'; | ||||||||||||||||||||||||||||||
export const INTERNAL_COLLECTION = | ||||||||||||||||||||||||||||||
'The collection provided is reserved for use by MongoDB. Please choose a different name.'; | ||||||||||||||||||||||||||||||
export const INTERNAL_DATABASE = | ||||||||||||||||||||||||||||||
'The database provided is reserved for use by MongoDB. Please choose a different name.'; | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
type CreateNamespaceState = { | ||||||||||||||||||||||||||||||
isRunning: boolean; | ||||||||||||||||||||||||||||||
|
@@ -379,6 +383,14 @@ export const createNamespace = ( | |||||||||||||||||||||||||||||
dispatch(handleError(new Error(NO_DOT))); | ||||||||||||||||||||||||||||||
|
dispatch(handleError(new Error(NO_DOT))); | |
return dispatch(handleError(new Error(NO_DOT))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same wrt returns
if (dbName && toNS(dbName).special) { | |
dispatch(handleError(new Error(INTERNAL_DATABASE))); | |
} | |
if (toNS(namespace).special) { | |
dispatch(handleError(new Error(INTERNAL_COLLECTION))); | |
} | |
if (dbName && toNS(dbName).special) { | |
return dispatch(handleError(new Error(INTERNAL_DATABASE))); | |
} | |
if (toNS(namespace).special) { | |
return dispatch(handleError(new Error(INTERNAL_COLLECTION))); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the top of my head I think that should be an okay change, but I don't know enough about these special collections to say with confidence that we are not breaking some power user use-cases in Compass. Would it make sense to gate this with some new preference setting and allow people to opt-in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The relevant DBs can be found here. Aside from _mdb_internal* I think it's literally just
config
There do seem to be valid reasons to edit config, but only under exceptional circumstances (docs). I think you're right that this is a good use an opt-in preference