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

Method _construct

src/gridfs/upload.ts:149–170  ·  view source on GitHub ↗

* @internal * * The stream is considered constructed when the indexes are done being created

(callback: (error?: Error | null) => void)

Source from the content-addressed store, hash-verified

147 * The stream is considered constructed when the indexes are done being created
148 */
149 override _construct(callback: (error?: Error | null) => void): void {
150 if (!this.bucket.s.calledOpenUploadStream) {
151 this.bucket.s.calledOpenUploadStream = true;
152
153 checkIndexes(this).then(
154 () => {
155 this.bucket.s.checkedIndexes = true;
156 this.bucket.emit('index');
157 callback();
158 },
159 error => {
160 if (error instanceof MongoOperationTimeoutError) {
161 return handleError(this, error, callback);
162 }
163 squashError(error);
164 callback();
165 }
166 );
167 } else {
168 return queueMicrotask(callback);
169 }
170 }
171
172 /**
173 * @internal

Callers

nothing calls this directly

Calls 5

squashErrorFunction · 0.90
checkIndexesFunction · 0.85
handleErrorFunction · 0.70
emitMethod · 0.65
callbackFunction · 0.50

Tested by

no test coverage detected