@@ -63,7 +63,6 @@ expectType<ResumeToken>(change._id);
63
63
expectType < Timestamp | undefined > ( change . clusterTime ) ;
64
64
expectType < number | undefined > ( change . txnNumber ) ; // Could be a Long if promoteLongs is off
65
65
expectType < ServerSessionId | undefined > ( change . lsid ) ;
66
- expectType < Date | undefined > ( change . wallTime ) ;
67
66
68
67
type CrudChangeDoc =
69
68
| ChangeStreamInsertDocument < Schema > // C
@@ -76,6 +75,7 @@ declare const crudChange: CrudChangeDoc;
76
75
expectType < CrudChangeDoc extends ChangeStreamDocumentKey < Schema > ? true : false > ( true ) ;
77
76
expectType < number > ( crudChange . documentKey . _id ) ; // _id will get typed
78
77
expectType < any > ( crudChange . documentKey . blah ) ; // shard keys could be anything
78
+ expectType < Date | undefined > ( crudChange . wallTime ) ;
79
79
80
80
// ChangeStreamFullNameSpace
81
81
expectType < ChangeStreamNameSpace > ( crudChange . ns ) ;
@@ -88,12 +88,14 @@ switch (change.operationType) {
88
88
expectType < number > ( change . documentKey . _id ) ;
89
89
expectType < any > ( change . documentKey . blah ) ;
90
90
expectType < Schema > ( change . fullDocument ) ;
91
+ expectType < Date | undefined > ( change . wallTime ) ;
91
92
break ;
92
93
}
93
94
case 'update' : {
94
95
expectType < ChangeStreamUpdateDocument < Schema > > ( change ) ;
95
96
expectType < 'update' > ( change . operationType ) ;
96
97
expectType < Schema | undefined > ( change . fullDocument ) ; // Update only attaches fullDocument if configured
98
+ expectType < Date | undefined > ( change . wallTime ) ;
97
99
expectType < UpdateDescription < Schema > > ( change . updateDescription ) ;
98
100
expectType < Partial < Schema > | undefined > ( change . updateDescription . updatedFields ) ;
99
101
expectType < string [ ] | undefined > ( change . updateDescription . removedFields ) ;
@@ -105,61 +107,72 @@ switch (change.operationType) {
105
107
case 'replace' : {
106
108
expectType < ChangeStreamReplaceDocument < Schema > > ( change ) ;
107
109
expectType < 'replace' > ( change . operationType ) ;
110
+ expectType < Date | undefined > ( change . wallTime ) ;
108
111
expectType < Schema > ( change . fullDocument ) ;
109
112
break ;
110
113
}
111
114
case 'delete' : {
112
115
expectType < ChangeStreamDeleteDocument < Schema > > ( change ) ;
116
+ expectType < Date | undefined > ( change . wallTime ) ;
113
117
expectType < 'delete' > ( change . operationType ) ;
114
118
break ;
115
119
}
116
120
case 'drop' : {
117
121
expectType < ChangeStreamDropDocument > ( change ) ;
118
122
expectType < 'drop' > ( change . operationType ) ;
123
+ expectType < Date | undefined > ( change . wallTime ) ;
119
124
expectType < { db : string ; coll : string } > ( change . ns ) ;
120
125
break ;
121
126
}
122
127
case 'rename' : {
123
128
expectType < ChangeStreamRenameDocument > ( change ) ;
124
129
expectType < 'rename' > ( change . operationType ) ;
130
+ expectType < Date | undefined > ( change . wallTime ) ;
125
131
expectType < { db : string ; coll : string } > ( change . ns ) ;
126
132
expectType < { db : string ; coll : string } > ( change . to ) ;
127
133
break ;
128
134
}
129
135
case 'dropDatabase' : {
130
136
expectType < ChangeStreamDropDatabaseDocument > ( change ) ;
131
137
expectType < 'dropDatabase' > ( change . operationType ) ;
138
+ expectType < Date | undefined > ( change . wallTime ) ;
132
139
expectError ( change . ns . coll ) ;
133
140
break ;
134
141
}
135
142
case 'invalidate' : {
136
143
expectType < ChangeStreamInvalidateDocument > ( change ) ;
137
144
expectType < 'invalidate' > ( change . operationType ) ;
145
+ expectType < Date | undefined > ( change . wallTime ) ;
138
146
break ;
139
147
}
140
148
case 'create' : {
141
149
expectType < ChangeStreamCreateDocument > ( change ) ;
142
150
expectType < 'create' > ( change . operationType ) ;
151
+ expectType < Date | undefined > ( change . wallTime ) ;
143
152
break ;
144
153
}
145
154
case 'modify' : {
146
155
expectType < ChangeStreamCollModDocument > ( change ) ;
147
156
expectType < 'modify' > ( change . operationType ) ;
157
+ expectType < Date | undefined > ( change . wallTime ) ;
148
158
break ;
149
159
}
150
160
case 'createIndexes' : {
151
161
expectType < ChangeStreamCreateIndexDocument > ( change ) ;
152
162
expectType < 'createIndexes' > ( change . operationType ) ;
163
+ expectType < Date | undefined > ( change . wallTime ) ;
153
164
break ;
154
165
}
155
166
case 'dropIndexes' : {
156
167
expectType < ChangeStreamDropIndexDocument > ( change ) ;
157
168
expectType < 'dropIndexes' > ( change . operationType ) ;
169
+ expectType < Date | undefined > ( change . wallTime ) ;
158
170
break ;
159
171
}
160
172
case 'shardCollection' : {
161
173
expectType < ChangeStreamShardCollectionDocument > ( change ) ;
162
174
expectType < 'shardCollection' > ( change . operationType ) ;
175
+ expectType < Date | undefined > ( change . wallTime ) ;
163
176
break ;
164
177
}
165
178
case 'reshardCollection' : {
0 commit comments