0

I'm trying to connect to MongoDB remote server using a batch script to update collections:

cd Program Files\MongoDB\Server\3.0\bin
mongo.exe 
mongo.exe --eval "use mydb"
pause

I found solutions if the database is located within the local machine. I couldn't find any correct solution for remote servers. Please help me find a solution.

2
  • Could you please describe what do you exactly expect? Just connection and opening the remote console or something else? Commented Dec 19, 2019 at 5:17
  • I want to connect to database and then i will update collection on specific conditions.I need help with connection! Commented Dec 19, 2019 at 5:23

1 Answer 1

1

Assuming you just want to connect to MongoDB server and open mongoshell.

You need mongoshell installed to connect to remote MongoDB. Here are more details.

You can use --username and --password options to connect using specific user credentials.

You can refer this for how to use mongoshell.

Sign up to request clarification or add additional context in comments.

3 Comments

hey, i installed mongoshell.But i coudn't connect to database from shell. mongodb://username@hostname/mydb. I used the above syntax ,it doesn't work for me.
@Nagavarsha, what do you mean doesn't work. Could you please be specific.
can you please answer stackoverflow.com/questions/59433102/… this?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.