Error - connecting to: mongodb://127.0.0.1:27017 2022-04-11T17:21:32.757+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
I have written a shell script program to export data of mongo DB into json file, I am able to execute commands from outside of shell script - in terminal, but from shell script it says the above error. Using windows - powershell to run the script. Using same machine for running the script, individual commands when i run outside of shell files means in the Terminal executing well and giving result.