mykoman
mykoman

Reputation: 1905

Unable to use mongoexport on remote server

I am new with MongoDB and I have a test account on mongogb account. I am trying to export the database I have remotely and this has given me a lot of headaches. Can someone help me out on this please?

mongoexport \
    --host="myDbUser:DataBas3Pwd@mongodb://cluster0.raiy3.mongodb.net" \
    -d socialDeveloper \
    -c posts \
    --out social.json

When I run the code on my command line it returns the response:

2021-03-01T01:13:26.240+0100    could not connect to server: server selection error: server selection timeout, current topology: { Type: Single, Servers: [{ Addr: cluster0.raiy3.mongodb.net:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : dial tcp: lookup cluster0.raiy3.mongodb.net: no such host }, ] }

And here is where I got the connection details from on my mongoDb account

enter image description here

WHat do I need to change please?

Upvotes: 1

Views: 363

Answers (1)

Haniel Baez
Haniel Baez

Reputation: 1690

Try:

mongoexport 'mongodb+srv://myDbUser:[email protected]' --db=socialDeveloper --collection=posts --out=social.json

Upvotes: 1

Related Questions