Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
242 changes: 110 additions & 132 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 5 additions & 10 deletions packages/collection-model/lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,11 @@ const CollectionCollection = AmpersandCollection.extend(

this.set(
collections
.filter((coll) => {
// TODO: This is not the best place to do this kind of
// filtering, but for now this preserves the current behavior
// and changing it right away will expand the scope of the
// refactor significantly. We can address this in COMPASS-5211
return (
getNamespaceInfo(coll._id).system === false ||
getNamespaceInfo(coll._id).collection === 'system.profile'
);
})
// TODO: This is not the best place to do this kind of
// filtering, but for now this preserves the current behavior
// and changing it right away will expand the scope of the
// refactor significantly. We can address this in COMPASS-5211
.filter((coll) => getNamespaceInfo(coll._id).system === false)
.map(({ _id, ...rest }) => {
return {
_id,
Expand Down
2 changes: 1 addition & 1 deletion packages/collection-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"ampersand-collection": "^2.0.2",
"ampersand-model": "^8.0.1",
"mongodb-data-service": "^22.33.2",
"mongodb-ns": "^2.4.2"
"mongodb-ns": "^3.0.1"
},
"devDependencies": {
"@mongodb-js/eslint-config-compass": "^1.4.10",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-aggregations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"mongodb-data-service": "^22.33.2",
"mongodb-database-model": "^2.34.2",
"mongodb-instance-model": "^12.47.0",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"mongodb-query-parser": "^4.3.0",
"mongodb-schema": "^12.6.2",
"re-resizable": "^6.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-app-stores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"mongodb-database-model": "^2.34.2",
"mongodb-instance-model": "^12.47.0",
"compass-preferences-model": "^2.55.0",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"react": "^17.0.2"
},
"is_compass_plugin": true
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"hadron-document": "^8.10.2",
"mongodb": "^6.19.0",
"mongodb-collection-model": "^5.34.2",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"mongodb-schema": "^12.6.2",
"react": "^17.0.2",
"react-redux": "^8.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-crud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"lodash": "^4.17.21",
"mongodb": "^6.19.0",
"mongodb-data-service": "^22.33.2",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"mongodb-query-parser": "^4.3.0",
"numeral": "^2.0.6",
"react": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-data-modeling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"html-to-image": "1.11.11",
"lodash": "^4.17.21",
"mongodb": "^6.19.0",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"mongodb-schema": "^12.6.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"mongodb-build-info": "^1.7.2",
"mongodb-connection-string-url": "^3.0.1",
"mongodb-log-writer": "^2.3.4",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"mongodb-runner": "^5.8.0",
"node-fetch": "^2.7.0",
"nyc": "^15.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
createNumbersCollection,
} from '../helpers/insert-data';

const INITIAL_DATABASE_NAMES = ['admin', 'config', 'local', 'test'];
const INITIAL_DATABASE_NAMES = ['admin', 'local', 'test'];

describe('Instance databases tab', function () {
let compass: Compass;
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-export-to-language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"bson-transpilers": "^3.2.21",
"compass-preferences-model": "^2.55.0",
"@mongodb-js/compass-app-registry": "^9.4.24",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"react": "^17.0.2",
"react-redux": "^8.1.3",
"redux": "^4.2.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-global-writes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@mongodb-js/compass-app-registry": "^9.4.24",
"lodash": "^4.17.21",
"@mongodb-js/compass-field-store": "^9.51.0",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"react": "^17.0.2",
"react-redux": "^8.1.3",
"redux": "^4.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-import-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"lodash": "^4.17.21",
"mongodb": "^6.19.0",
"mongodb-data-service": "^22.33.2",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"mongodb-query-parser": "^4.3.0",
"mongodb-schema": "^12.6.2",
"papaparse": "^5.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-indexes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"mongodb-collection-model": "^5.34.2",
"mongodb-data-service": "^22.33.2",
"mongodb-mql-engines": "^0.0.4",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"mongodb-query-parser": "^4.3.0",
"numeral": "^2.0.6",
"react": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-query-bar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"lodash": "^4.17.21",
"mongodb": "^6.19.0",
"mongodb-instance-model": "^12.47.0",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"mongodb-query-parser": "^4.3.0",
"mongodb-query-util": "^2.5.9",
"mongodb-schema": "^12.6.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-saved-aggregations-queries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"bson": "^6.10.4",
"compass-preferences-model": "^2.55.0",
"fuse.js": "^6.5.3",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"react": "^17.0.2",
"react-redux": "^8.1.3",
"redux": "^4.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-schema-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"javascript-stringify": "^2.0.1",
"lodash": "^4.17.21",
"mongodb": "^6.19.0",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"mongodb-query-parser": "^4.3.0",
"react": "^17.0.2",
"react-redux": "^8.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-serverstats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"debug": "^4.3.4",
"@mongodb-js/compass-app-registry": "^9.4.24",
"lodash": "^4.17.21",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"reflux": "^0.4.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-sidebar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"lodash": "^4.17.21",
"mongodb": "^6.19.0",
"mongodb-instance-model": "^12.47.0",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"react": "^17.0.2",
"react-redux": "^8.1.3",
"redux": "^4.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"mongodb-build-info": "^1.7.2",
"mongodb-data-service": "^22.33.2",
"mongodb-log-writer": "^2.3.4",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"nyc": "^15.1.0",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-workspaces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"lodash": "^4.17.21",
"mongodb-collection-model": "^5.34.2",
"mongodb-database-model": "^2.34.2",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"react": "^17.0.2",
"react-redux": "^8.1.3",
"redux": "^4.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
"mongodb-connection-string-url": "^3.0.1",
"mongodb-data-service": "^22.33.2",
"mongodb-log-writer": "^2.3.4",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"resolve-mongodb-srv": "^1.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/data-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"mongodb": "^6.19.0",
"mongodb-build-info": "^1.7.2",
"mongodb-connection-string-url": "^3.0.1",
"mongodb-ns": "^2.4.2"
"mongodb-ns": "^3.0.1"
},
"devDependencies": {
"@mongodb-js/compass-test-server": "^0.3.21",
Expand Down
13 changes: 8 additions & 5 deletions packages/database-model/lib/model.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
const AmpersandModel = require('ampersand-model');
const AmpersandCollection = require('ampersand-collection');
const toNs = require('mongodb-ns');
const {
Collection: MongoDbCollectionCollection,
} = require('mongodb-collection-model');
Expand Down Expand Up @@ -262,11 +263,13 @@ const DatabaseCollection = AmpersandCollection.extend(
});

this.set(
dbs.map(({ _id, name, inferred_from_privileges }) => ({
_id,
name,
inferred_from_privileges,
}))
dbs
.filter((db) => toNs(db._id).special === false)
.map(({ _id, name, inferred_from_privileges }) => ({
_id,
name,
inferred_from_privileges,
}))
);
},

Expand Down
3 changes: 2 additions & 1 deletion packages/database-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"ampersand-collection": "^2.0.2",
"ampersand-model": "^8.0.1",
"mongodb-collection-model": "^5.34.2",
"mongodb-data-service": "^22.33.2"
"mongodb-data-service": "^22.33.2",
"mongodb-ns": "^3.0.1"
},
"devDependencies": {
"@mongodb-js/eslint-config-compass": "^1.4.10",
Expand Down
2 changes: 1 addition & 1 deletion packages/databases-collections-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"compass-preferences-model": "^2.55.0",
"mongodb-collection-model": "^5.34.2",
"mongodb-database-model": "^2.34.2",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"react": "^17.0.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/databases-collections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"mongodb-collection-model": "^5.34.2",
"mongodb-database-model": "^2.34.2",
"mongodb-instance-model": "^12.47.0",
"mongodb-ns": "^2.4.2",
"mongodb-ns": "^3.0.1",
"mongodb-query-parser": "^4.3.0",
"prop-types": "^15.7.2",
"react": "^17.0.2",
Expand Down
22 changes: 15 additions & 7 deletions packages/databases-collections/src/modules/create-namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -360,7 +364,7 @@ export async function handleFLE2Options(

export const createNamespace = (
data: CreateNamespaceOptions
): CreateNamespaceThunkAction<Promise<void>> => {
): CreateNamespaceThunkAction<Promise<HandleErrorAction | undefined>> => {
return async (
dispatch,
getState,
Expand All @@ -376,7 +380,15 @@ export const createNamespace = (
dispatch(clearError());

if (dbName && dbName.includes('.')) {
dispatch(handleError(new Error(NO_DOT)));
return dispatch(handleError(new Error(NO_DOT)));
}

if (dbName && toNS(dbName).special) {
return dispatch(handleError(new Error(INTERNAL_DATABASE)));
}

if (toNS(namespace).special) {
return dispatch(handleError(new Error(INTERNAL_COLLECTION)));
}

try {
Expand All @@ -403,15 +415,11 @@ export const createNamespace = (
connectionId,
});

// For special namespaces (admin, local, config), we do not want
// to navigate user to the global-writes tab if it's supported.
const isSpecialNS = toNS(namespace).isSpecial;
const isGlobalWritesSupported =
connectionInfo && connectionSupports(connectionInfo, 'globalWrites');
workspaces.openCollectionWorkspace(connectionId, namespace, {
newTab: true,
initialSubtab:
!isSpecialNS && isGlobalWritesSupported ? 'GlobalWrites' : undefined,
initialSubtab: isGlobalWritesSupported ? 'GlobalWrites' : undefined,
});
dispatch(reset());
} catch (e) {
Expand Down
Loading