How to execute mongo commands through shell scripts?
I want to execute mongo commands in shell script, e.g. in a script test.sh: #!/bin/sh mongo myDbName db.mycollection.findOne() show collections When I execute this script via ./test.sh, then the connection to MongoDB is established, but the following commands are not executed. How to execute other commands through shell script test.sh? 21 Answers 21 You can … Read more