Skip to content

Commit ccf555d

Browse files
authored
feat(NODE-5071): support additional time series options (#3667)
1 parent ba3437d commit ccf555d

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

src/operations/create_collection.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export interface TimeSeriesCollectionOptions extends Document {
4646
timeField: string;
4747
metaField?: string;
4848
granularity?: 'seconds' | 'minutes' | 'hours' | string;
49+
bucketMaxSpanSeconds?: number;
50+
bucketRoundingSeconds?: number;
4951
}
5052

5153
/** @public

test/spec/collection-management/timeseries-collection.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,71 @@
250250
]
251251
}
252252
]
253+
},
254+
{
255+
"description": "createCollection with bucketing options",
256+
"runOnRequirements": [
257+
{
258+
"minServerVersion": "7.0"
259+
}
260+
],
261+
"operations": [
262+
{
263+
"name": "dropCollection",
264+
"object": "database0",
265+
"arguments": {
266+
"collection": "test"
267+
}
268+
},
269+
{
270+
"name": "createCollection",
271+
"object": "database0",
272+
"arguments": {
273+
"collection": "test",
274+
"timeseries": {
275+
"timeField": "time",
276+
"bucketMaxSpanSeconds": 3600,
277+
"bucketRoundingSeconds": 3600
278+
}
279+
}
280+
},
281+
{
282+
"name": "assertCollectionExists",
283+
"object": "testRunner",
284+
"arguments": {
285+
"databaseName": "ts-tests",
286+
"collectionName": "test"
287+
}
288+
}
289+
],
290+
"expectEvents": [
291+
{
292+
"client": "client0",
293+
"events": [
294+
{
295+
"commandStartedEvent": {
296+
"command": {
297+
"drop": "test"
298+
},
299+
"databaseName": "ts-tests"
300+
}
301+
},
302+
{
303+
"commandStartedEvent": {
304+
"command": {
305+
"create": "test",
306+
"timeseries": {
307+
"timeField": "time",
308+
"bucketMaxSpanSeconds": 3600,
309+
"bucketRoundingSeconds": 3600
310+
}
311+
},
312+
"databaseName": "ts-tests"
313+
}
314+
}
315+
]
316+
}
317+
]
253318
}
254319
]
255320
}

test/spec/collection-management/timeseries-collection.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,38 @@ tests:
127127
filter: {}
128128
sort: { time: 1 }
129129
databaseName: *database0Name
130+
131+
- description: "createCollection with bucketing options"
132+
runOnRequirements:
133+
- minServerVersion: "7.0"
134+
operations:
135+
- name: dropCollection
136+
object: *database0
137+
arguments:
138+
collection: *collection0Name
139+
- name: createCollection
140+
object: *database0
141+
arguments:
142+
collection: *collection0Name
143+
timeseries: &timeseries1
144+
timeField: "time"
145+
bucketMaxSpanSeconds: 3600
146+
bucketRoundingSeconds: 3600
147+
- name: assertCollectionExists
148+
object: testRunner
149+
arguments:
150+
databaseName: *database0Name
151+
collectionName: *collection0Name
152+
expectEvents:
153+
- client: *client0
154+
events:
155+
- commandStartedEvent:
156+
command:
157+
drop: *collection0Name
158+
databaseName: *database0Name
159+
- commandStartedEvent:
160+
command:
161+
create: *collection0Name
162+
timeseries: *timeseries1
163+
databaseName: *database0Name
164+

0 commit comments

Comments
 (0)