...
1description: "timeseries-collection"
2
3schemaVersion: "1.0"
4
5runOnRequirements:
6 - minServerVersion: "5.0"
7
8createEntities:
9 - client:
10 id: &client0 client0
11 observeEvents: [ commandStartedEvent ]
12 - database:
13 id: &database0 database0
14 client: *client0
15 databaseName: &database0Name ts-tests
16 - collection:
17 id: &collection0 collection0
18 database: *database0
19 collectionName: &collection0Name test
20
21initialData:
22 - collectionName: *collection0Name
23 databaseName: *database0Name
24 documents: []
25
26tests:
27 - description: "createCollection with all options"
28 operations:
29 - name: dropCollection
30 object: *database0
31 arguments:
32 collection: *collection0Name
33 - name: createCollection
34 object: *database0
35 arguments:
36 collection: *collection0Name
37 # expireAfterSeconds should be an int64 (as it is stored on the server).
38 expireAfterSeconds: 604800
39 timeseries: ×eries0
40 timeField: "time"
41 metaField: "meta"
42 granularity: "minutes"
43 - name: assertCollectionExists
44 object: testRunner
45 arguments:
46 databaseName: *database0Name
47 collectionName: *collection0Name
48 expectEvents:
49 - client: *client0
50 events:
51 - commandStartedEvent:
52 command:
53 drop: *collection0Name
54 databaseName: *database0Name
55 - commandStartedEvent:
56 command:
57 create: *collection0Name
58 expireAfterSeconds: 604800
59 timeseries: *timeseries0
60 databaseName: *database0Name
61
62 # Unlike regular collections, time-series collections allow duplicate ids.
63 - description: "insertMany with duplicate ids"
64 operations:
65 - name: dropCollection
66 object: *database0
67 arguments:
68 collection: *collection0Name
69 - name: createCollection
70 object: *database0
71 arguments:
72 collection: *collection0Name
73 # expireAfterSeconds should be an int64 (as it is stored on the server).
74 expireAfterSeconds: 604800
75 timeseries: *timeseries0
76 - name: assertCollectionExists
77 object: testRunner
78 arguments:
79 databaseName: *database0Name
80 collectionName: *collection0Name
81 - name: insertMany
82 object: *collection0
83 arguments:
84 documents: &docs
85 - {
86 _id: 1,
87 time: {
88 $date: {
89 $numberLong: "1552949630482"
90 }
91 }
92 }
93 - {
94 _id: 1,
95 time: {
96 $date: {
97 $numberLong: "1552949630483"
98 }
99 }
100 }
101 - name: find
102 object: *collection0
103 arguments:
104 filter: {}
105 sort: { time: 1 }
106 expectResult: *docs
107 expectEvents:
108 - client: *client0
109 events:
110 - commandStartedEvent:
111 command:
112 drop: *collection0Name
113 databaseName: *database0Name
114 - commandStartedEvent:
115 command:
116 create: *collection0Name
117 expireAfterSeconds: 604800
118 timeseries: *timeseries0
119 databaseName: *database0Name
120 - commandStartedEvent:
121 command:
122 insert: *collection0Name
123 documents: *docs
124 - commandStartedEvent:
125 command:
126 find: *collection0Name
127 filter: {}
128 sort: { time: 1 }
129 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: ×eries1
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
View as plain text