diff --git a/packages/collection-model/lib/collection-properties.js b/packages/collection-model/lib/collection-properties.js index 97382c2f4ec..befb5aacda8 100644 --- a/packages/collection-model/lib/collection-properties.js +++ b/packages/collection-model/lib/collection-properties.js @@ -7,6 +7,9 @@ const PROPERTIES_FLE2 = 'fle2'; const PROPERTIES_VIEW = 'view'; const PROPERTIES_READ_ONLY = 'read-only'; +/** + * @param {import('../').CollectionProps} coll + */ function getProperties(coll) { const properties = []; @@ -29,7 +32,7 @@ function getProperties(coll) { }); } - if (coll.capped) { + if (coll.is_capped) { properties.push({ id: PROPERTIES_CAPPED, }); diff --git a/packages/collection-model/lib/model.js b/packages/collection-model/lib/model.js index 25f4357cfbd..8b7ab68fd55 100644 --- a/packages/collection-model/lib/model.js +++ b/packages/collection-model/lib/model.js @@ -222,7 +222,7 @@ const CollectionModel = AmpersandModel.extend(debounceActions(['fetch']), { }, }, properties: { - deps: ['collation', 'type', 'capped', 'clustered', 'readonly', 'fle2'], + deps: ['collation', 'type', 'is_capped', 'clustered', 'readonly', 'fle2'], fn() { return getProperties(this); }, diff --git a/packages/compass-e2e-tests/helpers/commands/add-collection.ts b/packages/compass-e2e-tests/helpers/commands/add-collection.ts index 409a1f5da63..373ba061d35 100644 --- a/packages/compass-e2e-tests/helpers/commands/add-collection.ts +++ b/packages/compass-e2e-tests/helpers/commands/add-collection.ts @@ -2,9 +2,6 @@ import type { CompassBrowser } from '../compass-browser'; import * as Selectors from '../selectors'; export type AddCollectionOptions = { - capped?: { - size: number; - }; customCollation?: { locale: string; strength: number; @@ -51,15 +48,6 @@ export async function addCollection( ); } - if (collectionOptions && collectionOptions.capped) { - await browser.clickVisible(Selectors.CreateCollectionCappedCheckboxLabel); - - await browser.setValueVisible( - Selectors.CreateCollectionCappedSizeInput, - collectionOptions.capped.size.toString() - ); - } - if (collectionOptions && collectionOptions.customCollation) { await browser.clickVisible( Selectors.CreateCollectionCustomCollationCheckboxLabel diff --git a/packages/compass-e2e-tests/helpers/selectors.ts b/packages/compass-e2e-tests/helpers/selectors.ts index 2f4dadd4d67..8dab150319a 100644 --- a/packages/compass-e2e-tests/helpers/selectors.ts +++ b/packages/compass-e2e-tests/helpers/selectors.ts @@ -458,10 +458,6 @@ export const CreateCollectionCreateButton = '[data-testid="create-collection-modal"] [data-testid="submit-button"]'; export const CreateCollectionCancelButton = '[data-testid="create-collection-modal"] [data-testid="cancel-button"]'; -export const CreateCollectionCappedCheckboxLabel = - '[data-testid="capped-collection-fields"] [data-testid="capped-collection-fields-label"]'; -export const CreateCollectionCappedSizeInput = - '[data-testid="capped-collection-fields"] [data-testid="capped-size"]'; export const CreateCollectionCollectionOptionsAccordion = '[data-testid="create-collection-modal"] [data-testid="additional-collection-preferences"]'; export const CreateCollectionCustomCollationCheckboxLabel = diff --git a/packages/compass-e2e-tests/tests/database-collections-tab.test.ts b/packages/compass-e2e-tests/tests/database-collections-tab.test.ts index a4f2c91962f..86181e19d6c 100644 --- a/packages/compass-e2e-tests/tests/database-collections-tab.test.ts +++ b/packages/compass-e2e-tests/tests/database-collections-tab.test.ts @@ -174,39 +174,6 @@ describe('Database collections tab', function () { await browser.waitUntilActiveDatabaseTab(DEFAULT_CONNECTION_NAME_1, 'test'); }); - it('can create a capped collection', async function () { - const collectionName = 'my-capped-collection'; - - // open the create collection modal from the button at the top - await browser.clickVisible(Selectors.DatabaseCreateCollectionButton); - - await browser.addCollection( - collectionName, - { - capped: { - size: 1000, - }, - }, - 'add-collection-modal-capped.png' - ); - - await browser.navigateToDatabaseCollectionsTab( - DEFAULT_CONNECTION_NAME_1, - 'test' - ); - - const selector = Selectors.collectionCard('test', collectionName); - await browser.scrollToVirtualItem( - Selectors.CollectionsGrid, - selector, - 'grid' - ); - const collectionCard = browser.$(selector); - await collectionCard.waitForDisplayed(); - - // TODO: how do we make sure this is really a capped collection? - }); - it('can create a collection with custom collation', async function () { const collectionName = 'my-custom-collation-collection'; diff --git a/packages/compass-telemetry/src/telemetry-events.ts b/packages/compass-telemetry/src/telemetry-events.ts index 7f6eec34f65..2ce87fb0fa8 100644 --- a/packages/compass-telemetry/src/telemetry-events.ts +++ b/packages/compass-telemetry/src/telemetry-events.ts @@ -2253,11 +2253,6 @@ type SwitchViewTypeEvent = ConnectionScopedEvent<{ type CollectionCreatedEvent = ConnectionScopedEvent<{ name: 'Collection Created'; payload: { - /** - * Indicates whether the collection is capped. - */ - is_capped: boolean; - /** * Indicates whether the collection has a custom collation. */ @@ -2293,11 +2288,6 @@ type CollectionCreatedEvent = ConnectionScopedEvent<{ type DatabaseCreatedEvent = ConnectionScopedEvent<{ name: 'Database Created'; payload: { - /** - * Indicates whether the first collection in the database is capped. - */ - is_capped: boolean; - /** * Indicates whether the first collection in the database has a custom collation. */ diff --git a/packages/databases-collections/src/components/collection-fields/capped-collection-fields.jsx b/packages/databases-collections/src/components/collection-fields/capped-collection-fields.jsx deleted file mode 100644 index 858f91858f5..00000000000 --- a/packages/databases-collections/src/components/collection-fields/capped-collection-fields.jsx +++ /dev/null @@ -1,56 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { - CollapsibleFieldSet, - FormFieldContainer, - TextInput, -} from '@mongodb-js/compass-components'; - -const HELP_URL_CAPPED = - 'https://docs.mongodb.com/manual/core/capped-collections/'; - -function CappedCollectionFields({ - cappedSize, - isCapped, - isClustered, - isTimeSeries, - isFLE2, - onChangeCappedSize, - onChangeIsCapped, -}) { - return ( - onChangeIsCapped(checked)} - label="Capped Collection" - data-testid="capped-collection-fields" - helpUrl={HELP_URL_CAPPED} - description="Fixed-size collections that support high-throughput operations that insert and retrieve documents based on insertion order." - > - - onChangeCappedSize(e.target.value)} - spellCheck={false} - /> - - - ); -} - -CappedCollectionFields.propTypes = { - cappedSize: PropTypes.string.isRequired, - isCapped: PropTypes.bool.isRequired, - isTimeSeries: PropTypes.bool.isRequired, - isClustered: PropTypes.bool.isRequired, - isFLE2: PropTypes.bool.isRequired, - onChangeCappedSize: PropTypes.func.isRequired, - onChangeIsCapped: PropTypes.func.isRequired, -}; - -export default CappedCollectionFields; diff --git a/packages/databases-collections/src/components/collection-fields/capped-collection-fields.spec.jsx b/packages/databases-collections/src/components/collection-fields/capped-collection-fields.spec.jsx deleted file mode 100644 index d69f94e226b..00000000000 --- a/packages/databases-collections/src/components/collection-fields/capped-collection-fields.spec.jsx +++ /dev/null @@ -1,142 +0,0 @@ -import React from 'react'; -import { mount } from 'enzyme'; -import { expect } from 'chai'; -import { TextInput } from '@mongodb-js/compass-components'; - -import CappedCollectionFields from './capped-collection-fields'; - -describe('CappedCollectionFields [Component]', function () { - context('when isTimeSeries prop is true', function () { - let component; - - beforeEach(function () { - component = mount( - {}} - onChangeIsCapped={() => {}} - cappedSize={'0'} - /> - ); - }); - - afterEach(function () { - component = null; - }); - - it('renders the checkbox disabled', function () { - expect(component.find('Checkbox').props().disabled).to.equal(true); - }); - }); - - context('when isCapped prop is true', function () { - let component; - - beforeEach(function () { - component = mount( - {}} - onChangeIsCapped={() => {}} - cappedSize={'0'} - /> - ); - }); - - afterEach(function () { - component = null; - }); - - it('renders the inputs ', function () { - expect(component.find(TextInput).length).to.equal(1); - }); - }); - - context('when isTimeSeries prop is false', function () { - let component; - - beforeEach(function () { - component = mount( - {}} - onChangeIsCapped={() => {}} - cappedSize={'0'} - /> - ); - }); - - afterEach(function () { - component = null; - }); - - it('does not render the fields', function () { - expect(component.find(TextInput).length).to.equal(0); - }); - - it('has the capped collection checkbox enabled', function () { - expect(component.find('Checkbox').props().disabled).to.equal(false); - }); - }); - - context('when isClustered prop is true', function () { - let component; - - beforeEach(function () { - component = mount( - {}} - onChangeIsCapped={() => {}} - cappedSize={'0'} - /> - ); - }); - - afterEach(function () { - component = null; - }); - - it('renders the checkbox disabled', function () { - expect(component.find('Checkbox').props().disabled).to.equal(true); - }); - }); - - context('when isFLE2 prop is true', function () { - let component; - - beforeEach(function () { - component = mount( - {}} - onChangeIsCapped={() => {}} - cappedSize={'0'} - /> - ); - }); - - afterEach(function () { - component = null; - }); - - it('renders the checkbox disabled', function () { - expect(component.find('Checkbox').props().disabled).to.equal(true); - }); - }); -}); diff --git a/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.jsx b/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.jsx index f7ad28e2b76..4fe83629e7c 100644 --- a/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.jsx +++ b/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.jsx @@ -15,7 +15,6 @@ const EXPIRE_AFTER_SECONDS_DESCRIPTION = 'The _id field must be a date or an array that contains date values.'; function ClusteredCollectionFields({ - isCapped, isTimeSeries, isClustered, clusteredIndex, @@ -34,7 +33,7 @@ function ClusteredCollectionFields({ return ( onChangeIsClustered(checked)} label="Clustered Collection" data-testid="clustered-collection-fields" @@ -72,7 +71,6 @@ function ClusteredCollectionFields({ } ClusteredCollectionFields.propTypes = { - isCapped: PropTypes.bool.isRequired, isTimeSeries: PropTypes.bool.isRequired, isClustered: PropTypes.bool.isRequired, clusteredIndex: PropTypes.object.isRequired, diff --git a/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.spec.jsx b/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.spec.jsx index 9fb5f0cd22b..9b2dadea38d 100644 --- a/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.spec.jsx +++ b/packages/databases-collections/src/components/collection-fields/clustered-collection-fields.spec.jsx @@ -14,7 +14,6 @@ describe('ClusteredCollectionFields [Component]', function () { component = mount( {}} @@ -40,7 +39,6 @@ describe('ClusteredCollectionFields [Component]', function () { component = mount( {}} @@ -72,7 +70,6 @@ describe('ClusteredCollectionFields [Component]', function () { component = mount( {}} - onChangeField={() => {}} - expireAfterSeconds="" - /> - ); - }); - - afterEach(function () { - component = null; - }); - - it('has the clustered checkbox disabled', function () { - expect(component.find('Checkbox').props().disabled).to.equal(true); - }); - }); }); diff --git a/packages/databases-collections/src/components/collection-fields/collection-fields.jsx b/packages/databases-collections/src/components/collection-fields/collection-fields.jsx index ef2b422d567..2d46a559cb8 100644 --- a/packages/databases-collections/src/components/collection-fields/collection-fields.jsx +++ b/packages/databases-collections/src/components/collection-fields/collection-fields.jsx @@ -4,7 +4,6 @@ import PropTypes from 'prop-types'; import _ from 'lodash'; import { Accordion, spacing, css } from '@mongodb-js/compass-components'; -import CappedCollectionFields from './capped-collection-fields'; import CollectionName from './collection-name'; import DatabaseName from './database-name'; import hasTimeSeriesSupport from './has-time-series-support'; @@ -45,13 +44,11 @@ export default class CollectionFields extends PureComponent { }; state = { - isCapped: false, isCustomCollation: false, isTimeSeries: false, isClustered: false, isFLE2: false, fields: { - cappedSize: '', collation: {}, collectionName: '', databaseName: '', @@ -90,18 +87,8 @@ export default class CollectionFields extends PureComponent { }; buildOptions() { - const { - isCapped, - isCustomCollation, - isTimeSeries, - isClustered, - isFLE2, - fields, - } = this.state; - - const cappedOptions = isCapped - ? { capped: true, size: asNumber(fields.cappedSize) } - : {}; + const { isCustomCollation, isTimeSeries, isClustered, isFLE2, fields } = + this.state; const collationOptions = isCustomCollation ? { collation: fields.collation } @@ -141,7 +128,6 @@ export default class CollectionFields extends PureComponent { return omitEmptyFormFields({ ...collationOptions, - ...cappedOptions, ...timeSeriesOptions, ...clusteredOptions, ...fle2Options, @@ -151,19 +137,12 @@ export default class CollectionFields extends PureComponent { render() { const { serverVersion, withDatabase } = this.props; - const { - fields, - isCapped, - isCustomCollation, - isTimeSeries, - isClustered, - isFLE2, - } = this.state; + const { fields, isCustomCollation, isTimeSeries, isClustered, isFLE2 } = + this.state; const { collectionName, databaseName, - cappedSize, collation, timeSeries, expireAfterSeconds, @@ -189,7 +168,6 @@ export default class CollectionFields extends PureComponent { /> {hasTimeSeriesSupport(serverVersion) && (
- - this.setField('cappedSize', newCappedSizeString) - } - onChangeIsCapped={(capped) => - this.setState({ isCapped: capped }, this.updateOptions) - } - /> { @@ -243,7 +208,6 @@ export default class CollectionFields extends PureComponent { /> {hasClusteredCollectionSupport(serverVersion) && ( onChangeIsFLE2(checked)} // Queryable Encryption is the user-facing name of FLE2 label="Queryable Encryption" @@ -169,7 +168,6 @@ function FLE2Fields({ } FLE2Fields.propTypes = { - isCapped: PropTypes.bool.isRequired, isTimeSeries: PropTypes.bool.isRequired, isFLE2: PropTypes.bool.isRequired, onChangeIsFLE2: PropTypes.func.isRequired, diff --git a/packages/databases-collections/src/components/collection-fields/fle2-fields.spec.jsx b/packages/databases-collections/src/components/collection-fields/fle2-fields.spec.jsx index 02035ca5bb6..3d25b0ca714 100644 --- a/packages/databases-collections/src/components/collection-fields/fle2-fields.spec.jsx +++ b/packages/databases-collections/src/components/collection-fields/fle2-fields.spec.jsx @@ -15,7 +15,6 @@ describe('FLE2Fields [Component]', function () { component = mount( {}} - onChangeField={() => {}} - expireAfterSeconds="" - /> - ); - }); - - afterEach(function () { - component = null; - }); - - it('has the FLE2 checkbox disabled', function () { - expect(component.find('Checkbox').props().disabled).to.equal(true); - }); - }); - describe('when the isTimeSeries prop is true', function () { let component; @@ -143,7 +112,6 @@ describe('FLE2Fields [Component]', function () { component = mount( onChangeIsTimeSeries(checked)} toggled={isTimeSeries} label="Time-Series" @@ -174,7 +173,6 @@ function TimeSeriesFields({ } TimeSeriesFields.propTypes = { - isCapped: PropTypes.bool.isRequired, isTimeSeries: PropTypes.bool.isRequired, isClustered: PropTypes.bool.isRequired, isFLE2: PropTypes.bool.isRequired, diff --git a/packages/databases-collections/src/components/collection-fields/time-series-fields.spec.jsx b/packages/databases-collections/src/components/collection-fields/time-series-fields.spec.jsx index 95b529834eb..4439f94be35 100644 --- a/packages/databases-collections/src/components/collection-fields/time-series-fields.spec.jsx +++ b/packages/databases-collections/src/components/collection-fields/time-series-fields.spec.jsx @@ -14,7 +14,6 @@ describe('TimeSeriesFields [Component]', function () { component = mount( {}} - onChangeField={() => {}} - timeSeries={{}} - expireAfterSeconds="" - /> - ); - }); - - afterEach(function () { - component = null; - }); - - it('has the time-series checkbox disabled', function () { - expect(component.find('Checkbox').props().disabled).to.equal(true); - }); - }); - describe('when supportsFlexibleBucketConfiguration is true', function () { it('renders flexible bucketing options', function () { const component = mount( ; timeseries?: Record; @@ -389,7 +388,6 @@ export const createNamespace = ( await ds.createCollection(namespace, (options as any) ?? {}); const trackEvent = { - is_capped: !!data.options.capped, has_collation: !!data.options.collation, is_timeseries: !!data.options.timeseries, is_clustered: !!data.options.clusteredIndex,