JKHeadley / rest-hapi

🚀 A RESTful API generator for Node.js
https://resthapi.com
MIT License
1.19k stars 152 forks source link

error when mongodb uri with mongodb+srv #168

Open karabaralex opened 5 years ago

karabaralex commented 5 years ago

steps to repro:

  1. create a mongodb cluster at Atlas
  2. get connection uri which looks like mongodb+srv://.mongodb.net/test?retryWrites=true
  3. add this uri to rest-hapi config
      mongo: {
        URI: 'mongodb+srv://<some>.mongodb.net/test?retryWrites=true',
      },
  4. npm start
UnhandledPromiseRejectionWarning: Error: Invalid mongodb uri "mongodb+srv://<name>mongodb.net/test?retryWrites=true". Must begin with "mongodb://"
    at muri (/node_modules/muri/lib/index.js:28:11)
    at NativeConnection.Connection._handleOpenArgs (/node_modules/mongoose/lib/connection.js:199:16)