1
1
import { type Connection } from '..' ;
2
2
import type { BSONSerializeOptions , Document } from '../bson' ;
3
+ import { MIN_SUPPORTED_RAW_DATA_WIRE_VERSION } from '../cmap/wire_protocol/constants' ;
3
4
import { MongoInvalidArgumentError } from '../error' ;
4
5
import {
5
6
decorateWithExplain ,
@@ -12,7 +13,7 @@ import type { ReadPreference } from '../read_preference';
12
13
import type { ServerCommandOptions } from '../sdam/server' ;
13
14
import type { ClientSession } from '../sessions' ;
14
15
import { type TimeoutContext } from '../timeout' ;
15
- import { commandSupportsReadConcern , MongoDBNamespace } from '../utils' ;
16
+ import { commandSupportsReadConcern , maxWireVersion , MongoDBNamespace } from '../utils' ;
16
17
import { WriteConcern , type WriteConcernOptions } from '../write_concern' ;
17
18
import type { ReadConcernLike } from './../read_concern' ;
18
19
import { AbstractOperation , Aspect , type OperationOptions } from './operation' ;
@@ -63,6 +64,14 @@ export interface CommandOperationOptions
63
64
* This option is deprecated and will be removed in an upcoming major version.
64
65
*/
65
66
noResponse ?: boolean ;
67
+
68
+ /**
69
+ * Used when the command needs to grant access to the underlying namespaces for time series collections.
70
+ * Only available on server versions 8.2 and above.
71
+ * @public
72
+ * @sinceServerVersion 8.2
73
+ **/
74
+ rawData ?: boolean ;
66
75
}
67
76
68
77
/** @internal */
@@ -153,6 +162,14 @@ export abstract class CommandOperation<T> extends AbstractOperation<T> {
153
162
command . maxTimeMS = this . options . maxTimeMS ;
154
163
}
155
164
165
+ if (
166
+ this . options . rawData != null &&
167
+ this . hasAspect ( Aspect . SUPPORTS_RAW_DATA ) &&
168
+ maxWireVersion ( connection ) >= MIN_SUPPORTED_RAW_DATA_WIRE_VERSION
169
+ ) {
170
+ command . rawData = this . options . rawData ;
171
+ }
172
+
156
173
if ( this . hasAspect ( Aspect . EXPLAINABLE ) && this . explain ) {
157
174
return decorateWithExplain ( command , this . explain ) ;
158
175
}
0 commit comments