diff --git a/src/operations/create_collection.ts b/src/operations/create_collection.ts index b15842c08f..2e0d67c938 100644 --- a/src/operations/create_collection.ts +++ b/src/operations/create_collection.ts @@ -46,6 +46,8 @@ export interface TimeSeriesCollectionOptions extends Document { timeField: string; metaField?: string; granularity?: 'seconds' | 'minutes' | 'hours' | string; + bucketMaxSpanSeconds?: number; + bucketRoundingSeconds?: number; } /** @public diff --git a/test/spec/collection-management/timeseries-collection.json b/test/spec/collection-management/timeseries-collection.json index b5638fd36e..8525056fd1 100644 --- a/test/spec/collection-management/timeseries-collection.json +++ b/test/spec/collection-management/timeseries-collection.json @@ -250,6 +250,71 @@ ] } ] + }, + { + "description": "createCollection with bucketing options", + "runOnRequirements": [ + { + "minServerVersion": "7.0" + } + ], + "operations": [ + { + "name": "dropCollection", + "object": "database0", + "arguments": { + "collection": "test" + } + }, + { + "name": "createCollection", + "object": "database0", + "arguments": { + "collection": "test", + "timeseries": { + "timeField": "time", + "bucketMaxSpanSeconds": 3600, + "bucketRoundingSeconds": 3600 + } + } + }, + { + "name": "assertCollectionExists", + "object": "testRunner", + "arguments": { + "databaseName": "ts-tests", + "collectionName": "test" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "drop": "test" + }, + "databaseName": "ts-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "create": "test", + "timeseries": { + "timeField": "time", + "bucketMaxSpanSeconds": 3600, + "bucketRoundingSeconds": 3600 + } + }, + "databaseName": "ts-tests" + } + } + ] + } + ] } ] } diff --git a/test/spec/collection-management/timeseries-collection.yml b/test/spec/collection-management/timeseries-collection.yml index cbc09b34ca..00f22709b0 100644 --- a/test/spec/collection-management/timeseries-collection.yml +++ b/test/spec/collection-management/timeseries-collection.yml @@ -127,3 +127,38 @@ tests: filter: {} sort: { time: 1 } databaseName: *database0Name + + - description: "createCollection with bucketing options" + runOnRequirements: + - minServerVersion: "7.0" + operations: + - name: dropCollection + object: *database0 + arguments: + collection: *collection0Name + - name: createCollection + object: *database0 + arguments: + collection: *collection0Name + timeseries: ×eries1 + timeField: "time" + bucketMaxSpanSeconds: 3600 + bucketRoundingSeconds: 3600 + - name: assertCollectionExists + object: testRunner + arguments: + databaseName: *database0Name + collectionName: *collection0Name + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + drop: *collection0Name + databaseName: *database0Name + - commandStartedEvent: + command: + create: *collection0Name + timeseries: *timeseries1 + databaseName: *database0Name +