Skip to content

Commit

Permalink
feat(NODE-5071): support additional time series options (#3667)
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed May 12, 2023
1 parent ba3437d commit ccf555d
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/operations/create_collection.ts
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
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
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

0 comments on commit ccf555d

Please sign in to comment.