Skip to content

MongoDb not support extra connection options  #11064

@StagnantIce

Description

@StagnantIce

What was unclear or otherwise insufficient?

I can't use options from mongoDb 6, for example maxPoolSize, otherwise I get error that poolSize is not supported.

https://mongodb.github.io/node-mongodb-native/

    buildConnectionOptions(options) {
        const mongoOptions = {};
        for (let index = 0; index < this.validOptionNames.length; index++) {
            const optionName = this.validOptionNames[index];
            if (options.extra && optionName in options.extra) {
                mongoOptions[optionName] = options.extra[optionName];
            }
            else if (optionName in options) {
                mongoOptions[optionName] = options[optionName];
            }
        }
        return mongoOptions;
    }

validOptionNames is invalid here.

For mySql its looks like this

        return Object.assign({}, {
            resourceArn: options.resourceArn,
            secretArn: options.secretArn,
            database: options.database,
            region: options.region,
            type: options.type,
        }, {
            host: credentials.host,
            user: credentials.username,
            password: credentials.password,
            database: credentials.database,
            port: credentials.port,
            ssl: options.ssl,
        }, options.extra || {});

Fix may be looks like this


buildConnectionOptions(options) {
        const mongoOptions = {};
        for (let index = 0; index < this.validOptionNames.length; index++) {
            const optionName = this.validOptionNames[index];
            if (optionName in options) {
                mongoOptions[optionName] = options[optionName];
            }
        }
        return Object.assign(mongoOptions, options.extra ?? {});
    }

Recommended Fix

Give posibility add any extra (with options.extra) connection options

Additional Context

No response

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions