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,14 @@ 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+ * @sinceServerVersion 8.2
73+ **/
74+ rawData ?: boolean ;
6675}
6776
6877/** @internal */
@@ -153,6 +162,14 @@ export abstract class CommandOperation<T> extends AbstractOperation<T> {
153162 command . maxTimeMS = this . options . maxTimeMS ;
154163 }
155164
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+
156173 if ( this . hasAspect ( Aspect . EXPLAINABLE ) && this . explain ) {
157174 return decorateWithExplain ( command , this . explain ) ;
158175 }
0 commit comments