I have a Java code that code that calls a bash file along with arguments like:
String query="'{\"regionID\" : \"2\"}'";
ProcessBuilder pb = new ProcessBuilder("/query/sample.sh", database,
collection, query, username, password, host, port);
Process p=pb.start();
My sample.sh
file will look like
mongodump --host $6 --port $7 --db=$1 --collection=$2 -q $3 --out /query/backup/ --username $4 --password $5 --authenticationDatabase admin
When I try to run the mongodump the query fails but without the -q
parameter it works fine.