title: How to execute mongodb commands inside the bash script
body: <p>I'm trying to run mongo commands through my bash script file.</p>
  <p>I have sample.sh -- run with ./sample.sh</p>
  <p>I want to run below command inside my sample.sh file. It is bash script.
  I want to mongo commands run inside the file, not inside the shell.</p>
  <pre><code>kubectl exec $mongoPodName -c mongo-mongodb -- mongo db.createUser({user:&quot;admin&quot;,pwd:&quot;123456&quot;,roles:[{role:&quot;root&quot;,db:&quot;admin&quot;}]})
  
  </code></pre>
  <p>I get the error below :</p>
  <pre><code>./generate-service-dbs.sh: line 37: syntax error near unexpected token `('
  ./generate-service-dbs.sh: line 37: `kubectl exec $mongoPodName -c mongo-mongodb -- mongo db.createUser({user:&quot;admin&quot;,pwd:&quot;123456&quot;,roles:[{role:&quot;root&quot;,db:&quot;admin&quot;}]})'
  
  
  </code></pre>