title: Calling Mongodb's load() function from Java
body: <p>(I am using Mongo Java Driver 2.12.0, and Robomongo.)</p>
  
  <p>I am creating a mongo DB from java, and populating it with data all from Java. All that is working perfectly for me. I have made several javascript functions that I want in my database. If I insert these functions manually through the Robomongo shell using:</p>
  
  <pre><code>load('&lt;path&gt;\javaScriptFunction.js');
  </code></pre>
  
  <p>and call these in java through db.eval() these functions are running perfectly. Now what I want to do is that I want skip the step of loading these functions through Robomongo, and I want to load them to Mongodb directly through java. Now I have tried to load these functions to mongodb using java by executing the above mentioned load command through db.command(), and db.eval(), but none of these seem to be working.</p>
  
  <p>Is there are any other way to execute raw shell commands through java? How can I perform the task of loading javascript functions to mongodb through java?</p>
  
  <p>Any help would be much appreciated, thanks. I spent a complete day on it, yet could not find any reasonable result online.</p>