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

Method shift

src/cmap/wire_protocol/responses.ts:306–325  ·  view source on GitHub ↗
(options: OnDemandDocumentDeserializeOptions)

Source from the content-addressed store, hash-verified

304 }
305
306 public shift(options: OnDemandDocumentDeserializeOptions): any {
307 if (this.iterated >= this.batchSize) {
308 return null;
309 }
310
311 const result = this.batch.get(this.iterated, BSONType.object, true) ?? null;
312 const encryptedResult = this.encryptedBatch?.get(this.iterated, BSONType.object, true) ?? null;
313
314 this.iterated += 1;
315
316 if (options?.raw) {
317 return result.toBytes();
318 } else {
319 const object = result.toObject(options);
320 if (encryptedResult) {
321 decorateDecryptionResult(object, encryptedResult.toObject(options), true);
322 }
323 return object;
324 }
325 }
326
327 public clear() {
328 this.iterated = this.batchSize;

Callers 11

processWaitQueueMethod · 0.45
nextFunction · 0.45
eventHandlerFunction · 0.45
errorHandlerFunction · 0.45
readBufferedDocumentsFunction · 0.45
nextFunction · 0.45
tryNextFunction · 0.45
explainMethod · 0.45
explainMethod · 0.45
drainWaitQueueFunction · 0.45
processWaitQueueFunction · 0.45

Calls 4

decorateDecryptionResultFunction · 0.90
toBytesMethod · 0.80
getMethod · 0.45
toObjectMethod · 0.45

Tested by

no test coverage detected