MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/ai_allyindian_com/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientBulkWriteCursor = void 0;
const client_bulk_write_1 = require("../operations/client_bulk_write/client_bulk_write");
const execute_operation_1 = require("../operations/execute_operation");
const utils_1 = require("../utils");
const abstract_cursor_1 = require("./abstract_cursor");
/**
 * This is the cursor that handles client bulk write operations. Note this is never
 * exposed directly to the user and is always immediately exhausted.
 * @internal
 */
class ClientBulkWriteCursor extends abstract_cursor_1.AbstractCursor {
    /** @internal */
    constructor(client, commandBuilder, options = {}) {
        super(client, new utils_1.MongoDBNamespace('admin', '$cmd'), options);
        this.commandBuilder = commandBuilder;
        this.clientBulkWriteOptions = options;
    }
    /**
     * We need a way to get the top level cursor response fields for
     * generating the bulk write result, so we expose this here.
     */
    get response() {
        if (this.cursorResponse)
            return this.cursorResponse;
        return null;
    }
    get operations() {
        return this.commandBuilder.lastOperations;
    }
    clone() {
        const clonedOptions = (0, utils_1.mergeOptions)({}, this.clientBulkWriteOptions);
        delete clonedOptions.session;
        return new ClientBulkWriteCursor(this.client, this.commandBuilder, {
            ...clonedOptions
        });
    }
    /** @internal */
    async _initialize(session) {
        const clientBulkWriteOperation = new client_bulk_write_1.ClientBulkWriteOperation(this.commandBuilder, {
            ...this.clientBulkWriteOptions,
            ...this.cursorOptions,
            session
        });
        const response = await (0, execute_operation_1.executeOperation)(this.client, clientBulkWriteOperation, this.timeoutContext);
        this.cursorResponse = response;
        return { server: clientBulkWriteOperation.server, session, response };
    }
}
exports.ClientBulkWriteCursor = ClientBulkWriteCursor;
//# sourceMappingURL=client_bulk_write_cursor.js.map