R
Railway•13mo ago
mh1723

setting up discord bot with mongodb Atlas

Hello All, Like many here I am new to all of this. Im setting a discord bot, I have it running on my windows laptop. I deployed from github when setting it up and created the env variables in railway. I am getting this error from railway log:
Failed to connect to MongoDB: MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"
Failed to connect to MongoDB: MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"
My current token for is: "mongodb+srv://atlasinfo.mongodb.net/?retryWrites=true&w=majority" the atlasinfo is not what is actually in the token. I saw another post here about having to add all the ip's for railway to Atlas whitelist, which I did. Edit: I had also added 0.0.0.0 and no luck there.
12 Replies
Percy
Percy•13mo ago
Project ID: db268532-e2a0-4bda-97c2-c64fc139870b
mh1723
mh1723OP•13mo ago
db268532-e2a0-4bda-97c2-c64fc139870b
donutmuncha
donutmuncha•13mo ago
I am able to connect to mongodb atlas no problem from my railway app. is your complete connection string like this?
mongodb+srv://<USER>:<PASSWORD>.<CLUSTER>.mongodb.net/<DATABASE>?retryWrites=true&w=majority
mongodb+srv://<USER>:<PASSWORD>.<CLUSTER>.mongodb.net/<DATABASE>?retryWrites=true&w=majority
mh1723
mh1723OP•13mo ago
it doesnt look it like it has the <DATABASE> hmmm, mine just has /?
Fragly
Fragly•13mo ago
where are you getting your connection string from? 🤨
Fragly
Fragly•13mo ago
Go to Connect Then click on Drivers and you should see your connection string in step 3
No description
mh1723
mh1723OP•13mo ago
I had gotten it from atlas, thank you I was just clicking through everything trying to find it again! I copied it from connect>drivers and entered my username and password but still fails to connect
Brody
Brody•13mo ago
have you whitelisted all ips? 0.0.0.0/0
donutmuncha
donutmuncha•13mo ago
the steps I went through are: - create a user with username/password access - make sure that "cloud environment" is selected - it should provide a string be sure to assign said user to your db. eg magic-db-user is assigned to magic-db
mh1723
mh1723OP•13mo ago
I have and it looks like there was a connection at the same times I tried
No description
donutmuncha
donutmuncha•13mo ago
No description
mh1723
mh1723OP•13mo ago
thank you for the screenshot, I dont have those options. I get there from Security>Database Access. any suggestions out there? I ve done the google, the AI, and no luck. I dont have any special characters in the username or password, there's no semicolon at the end, I sent it to the console and it prints as it should with eeverything correct
Want results from more Discord servers?
Add your server