Skip to content

Can't connect to MongoDB atlas database #6664

@khaledosman

Description

@khaledosman

Mongoose v5.2.1

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Mongo connection error when trying to connect to MongoDB Atlas database..

{ MongoError: seed list contains no mongos proxies, replicaset connections requires the parameter replicaSet to be supplied in the URI or options object, mongodb://server:port/db?replicaSet=name
    at connectCallback (/node_modules/mongodb/lib/operations/mongo_client_ops.js:236:23)
    at process.nextTick (/node_modules/mongodb/lib/operations/mongo_client_ops.js:436:7)
    at process._tickCallback (internal/process/next_tick.js:61:11)
  name: 'MongoError',
  message:
   'seed list contains no mongos proxies, replicaset connections requires the parameter replicaSet to be supplied in the URI or options object, mongodb://server:port/db?replicaSet=name',
  [Symbol(mongoErrorContextSymbol)]: {} }

If the current behavior is a bug, please provide the steps to reproduce.

  1. create a free tier database from MongoDB Atlas and try to use the connection string
mongoose.connect(process.env.MONGO_URL, {
  reconnectTries: 100,
  reconnectInterval: 500,
  autoReconnect: true,
  useNewUrlParser: true,
  dbName: 'test'
})
  .catch(err => console.log('Mongo connection error', err))

Where MONGO_URL looks like mongodb+srv://<username>:<password>@<url>?retryWrites=true

What is the expected behavior?
Should connect successfully
Please mention your node.js, mongoose and MongoDB version.
node v10.5.0
mongoose v5.2.1
mongodb v3.6.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions