Skip to content
Merged
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
2 changes: 2 additions & 0 deletions src/operations/create_collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export interface TimeSeriesCollectionOptions extends Document {
timeField: string;
metaField?: string;
granularity?: 'seconds' | 'minutes' | 'hours' | string;
bucketMaxSpanSeconds?: number;
bucketRoundingSeconds?: number;
}

/** @public
Expand Down
65 changes: 65 additions & 0 deletions test/spec/collection-management/timeseries-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
}
]
}
]
}
35 changes: 35 additions & 0 deletions test/spec/collection-management/timeseries-collection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: &timeseries1
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