11import { type Connection } from '..' ;
22import type { BSONSerializeOptions , Document } from '../bson' ;
3+ import { MIN_SUPPORTED_RAW_DATA_WIRE_VERSION } from '../cmap/wire_protocol/constants' ;
34import { MongoInvalidArgumentError } from '../error' ;
45import {
56 decorateWithExplain ,
@@ -12,7 +13,7 @@ import type { ReadPreference } from '../read_preference';
1213import type { ServerCommandOptions } from '../sdam/server' ;
1314import type { ClientSession } from '../sessions' ;
1415import { type TimeoutContext } from '../timeout' ;
15- import { commandSupportsReadConcern , MongoDBNamespace } from '../utils' ;
16+ import { commandSupportsReadConcern , maxWireVersion , MongoDBNamespace } from '../utils' ;
1617import { WriteConcern , type WriteConcernOptions } from '../write_concern' ;
1718import type { ReadConcernLike } from './../read_concern' ;
1819import { AbstractOperation , Aspect , type OperationOptions } from './operation' ;
@@ -63,6 +64,13 @@ export interface CommandOperationOptions
6364 * This option is deprecated and will be removed in an upcoming major version.
6465 */
6566 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+ **/
73+ rawData ?: boolean ;
6674}
6775
6876/** @internal */
@@ -153,6 +161,14 @@ export abstract class CommandOperation<T> extends AbstractOperation<T> {
153161 command . maxTimeMS = this . options . maxTimeMS ;
154162 }
155163
164+ if (
165+ this . options . rawData != null &&
166+ this . hasAspect ( Aspect . SUPPORTS_RAW_DATA ) &&
167+ maxWireVersion ( connection ) >= MIN_SUPPORTED_RAW_DATA_WIRE_VERSION
168+ ) {
169+ command . rawData = this . options . rawData ;
170+ }
171+
156172 if ( this . hasAspect ( Aspect . EXPLAINABLE ) && this . explain ) {
157173 return decorateWithExplain ( command , this . explain ) ;
158174 }
0 commit comments