MCPcopy
hub / github.com/mongodb/node-mongodb-native / buildCommand

Function buildCommand

src/operations/command.ts:132–170  ·  src/operations/command.ts::buildCommand
(connection: Connection, session?: ClientSession)

Source from the content-addressed store, hash-verified

130 }
131
132 override buildCommand(connection: Connection, session?: ClientSession): Document {
133 const command = this.buildCommandDocument(connection, session);
134
135 const inTransaction = this.session && this.session.inTransaction();
136
137 if (this.readConcern && commandSupportsReadConcern(command) && !inTransaction) {
138 Object.assign(command, { readConcern: this.readConcern });
139 }
140
141 if (this.writeConcern && this.hasAspect(Aspect.WRITE_OPERATION) && !inTransaction) {
142 WriteConcern.apply(command, this.writeConcern);
143 }
144
145 if (
146 this.options.collation &&
147 typeof this.options.collation === class="st">'object' &&
148 !this.hasAspect(Aspect.SKIP_COLLATION)
149 ) {
150 Object.assign(command, { collation: this.options.collation });
151 }
152
153 if (typeof this.options.maxTimeMS === class="st">'number') {
154 command.maxTimeMS = this.options.maxTimeMS;
155 }
156
157 if (
158 this.options.rawData != null &&
159 this.hasAspect(Aspect.SUPPORTS_RAW_DATA) &&
160 maxWireVersion(connection) >= MIN_SUPPORTED_RAW_DATA_WIRE_VERSION
161 ) {
162 command.rawData = this.options.rawData;
163 }
164
165 if (this.hasAspect(Aspect.EXPLAINABLE) && this.explain) {
166 return decorateWithExplain(command, this.explain);
167 }
168
169 return command;
170 }
171}

Callers

nothing calls this directly

Calls 6

maxWireVersionFunction · 0.90
decorateWithExplainFunction · 0.90
inTransactionMethod · 0.80
applyMethod · 0.80
buildCommandDocumentMethod · 0.45

Tested by

no test coverage detected