MongoDB - Unable to load data set in Compass
I've connected to my MongDB instance by copying the
MONGO_URL
and connecting using MongoDB Compass.
I created a new table and imported all my collections.
However, if I try to load my site I get an error.
Upon closer inspection, and also utilising Data
tab on Railway, I can see the collections are empty. This is also confirmed by checking my applications api endpoint which exposes collections.
I feel like somwehere, as I seem to be loading the table that initialises Mongo,
What is the correct string I need to use to connect to my DB remotely?
The documention refers to an ENV named DATABASE_URL, but I can't see that in my Variables tab in the MongoDB service
https://docs.railway.app/databases/mongodb23 Replies
Project ID:
38aae1e6-ddf3-4d10-a02b-a590e97275f4
38aae1e6-ddf3-4d10-a02b-a590e97275f4
Solution
have you tried restarting the database?
no
try it
don't make me feel like Homer Simpson already lol
but yes
MONGO_URL
is the correct url to connect to your database externally, that page mentioning DATABASE_URL
is just a copy errorI've restarted the service, it seemed to be instant, however no joy
Compass still shows populated collections
you said empty and now you're saying populated?
ok, I restarted Compass. it's empty now
at least I have some consistency
any errors in mongo's logs?
no errors
right now it's kinda looking like you've just deleted the data?
Last night, I added data, and could see it each time I connected via Compass.
When I restarted Mongo just now and connected via Compass, it all disappeared.
I couldn't see any data in the CMS, so this is why I raised this ticket.
I'll add some data now via Compass and see if it appears in the CMS
I'm not relying solely upon the Data tab in Railway, but it was a good way to confirm doubts
do you have a backup? was the data important?
I am porting from MongoDB Atlas into Railway, I exported all the collections to JSON, so it's safe
okay cool
restarting seemed to have done the trick
you restarted the mongo service a second time?
do you perhaps still have a 500mb volume?
5GB volume according to mongo data
I assume any time I restart, the data will persist on the volume
correct
I can't believe it was as simple as restarting.
Thank you
I literally turned myself into an IT Crowd meme