cacheman-mongo icon indicating copy to clipboard operation
cacheman-mongo copied to clipboard

How to configure for a mongo replication set

Open codeuniquely opened this issue 8 years ago • 1 comments

when configured with more than one host

such as when passing this type of configuration

{
    host: 'db-host-01, db-host-02, db-host-03',
    username: 'db-user',
    password: 'db-pasword',
    database: 'db',
    collection: 'cached',
    compression: false
}

Any call to set results in a error being raised with this message.

"missing delimiting slash between hosts and options:"

The configuration is identical to the normal mongo configuration (which works) except for the mongo db has an additional option in the config

{
    replica: 'replset-name'
}

and when there is more than one host the connection string has to be formed like this:

Expected format - according to Mongo Docs

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

The connection string right now comes out with the wrong format (just a simple concatenation) of the properties and hence the error

wrong format

mongodb://[username:password@]db-host-01, db-host-02, db-host-03[:port1][/[database][?options]]

codeuniquely avatar Nov 03 '16 18:11 codeuniquely

any thoughts on this ?

codeuniquely avatar Nov 17 '16 13:11 codeuniquely