MongoDB question

50 views
Skip to first unread message

cloudxex

unread,
Jun 27, 2020, 9:29:02 AM6/27/20
to Tinode General
Hi Team,

I'm wondering if anyone has had this error when trying to initialise their mongo database?
I downloaded the MongoDB release and tried to run it in the command line and got this error back.
>init-db.exe -data=data.json

2020/06/27 23:23:58 Database mongodb 111
2020/06/27 23:23:58 Failed to init DB adapter: server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: [] }

My server is localhost:27017.
My Mongo version is db version v4.2.8

This is what my tinode config file has for MongoDb,

// MongoDB configuration.
"mongodb": {
// Address(es) of MongoDB node(s): either a string or an array of strings.
"addresses": "localhost:27017",
// Name of the main database.
"database": "tinode",
// Name of replica set of mongodb instance. Remove this line to use a standalone instance.
// If replica_set is disabled, transactions will be disabled as well.
"replica_set": "rs0",

// Authentication options. Uncomment if auth is configured on your MongoDB.
// "auth_source" is name of database that has the collection with the user credentials.
// Default is 'admin' if not set:
// "auth_source": "admin",

// Username:
// "username": "tinode",

// Password:
// "password": "tinode",

// Driver's TLS configuration. Uncomment to enable TLS.
//"tls": true,

// Path to the client certificate. Optional.
//"tls_cert_file": "/path/to/cert_file",

// Path to private key. Optional.
//"tls_private_key": "/path/to/private_key",

// Specifies whether or not certificates and hostnames received from the server should be validated.
// Not recommended to enable in production. Default is false.
//"tls_skip_verify": false
}

Any help is appreciated.

Thanks all.

Gene

unread,
Jun 27, 2020, 9:37:46 AM6/27/20
to Tinode General
Take a look at this conversation:

Try connecting to your mongo instance using mongo shell from the same host using the same exactly connection parameters.

Reply all
Reply to author
Forward
0 new messages