-
-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feathers fails to connect to MongoDB when connection string contains multiple routers #1044
Comments
The same error also occurs when the connection string contains two members of a replica set. It seems to occur no matter what where there is more than one host defined in the connection string. |
I think this has nothing to do with Feathers, there is actually no code related to Feathers in your post, this is probably an issue with your mongo client. If I run the following code:
Here is the output: |
My |
If this code has been generated by the CLI then it is a CLI issue because it does not work as expected. I guess you can patch by splitting the string first by |
Yes, I was able to fix the issue and get it working but ideally the generated file should work by default with any number of hosts in the connection string. |
The best way to make that happen would be a pull request into the generator with the fix you used to get it working 😄 |
Seems to be actually the case: #1002. |
Good point. This will work as long as you are using |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs. |
Steps to reproduce
I'm running into an issue where when my MongoDB connection string points to multiple
mongos
instances instead of just one, it fails to connect and returns the errordatabase names cannot contain the character '.'
even though my database name does not contain that character. When my connection string contains only one router, it doesn't return this error and works fine. I'm also able to connect to MongoDB using the mongo shell even when specifying multiple routers.The error is originating from here in my
mongodb.js
:Here is an example of what my connection string looks like:
"mongodb": "mongodb://feathers:password@host1.com:27017,host2.com:27017/database"
Expected behavior
The server should connect to MongoDB successfully.
Actual behavior
The server fails to connect and returns the following error:
System configuration
Module versions (especially the part that's not working):
"@feathersjs/feathers": "3.2.3"
"feathers-mongodb": "3.3.0"
"mongodb": "3.1.6"
NodeJS version: 10.11.0
The text was updated successfully, but these errors were encountered: