title: How to execute the mongo cloneCollection command to copy a collection to a remote server
body: <p>I'd like to copy a collection from one database to an instance on another server.  From <a href="https://stackoverflow.com/questions/8933307/clone-a-collection-in-mongodb">other stackoverflow</a> <a href="https://stackoverflow.com/questions/8933307/clone-a-collection-in-mongodb">questions</a>, I understand the correct way to do that is with this command:</p>
  
  <pre><code>{ cloneCollection: "&lt;collection&gt;", from: "&lt;hostname&gt;", query: { &lt;query&gt; } }
  </code></pre>
  
  <p>via <a href="http://docs.mongodb.org/manual/reference/command/cloneCollection/" rel="nofollow noreferrer">http://docs.mongodb.org/manual/reference/command/cloneCollection/</a></p>
  
  <p>However, I don't understand where do I enter this command?  It isn't accepted as...</p>
  
  <pre><code>$ mongod { cloneCollection: "remote", from: "ec2-whatever-amazon.com"}
  </code></pre>
  
  <p>How do I copy a remote collection at <code>db.remote.collname</code> to <code>db.local.collname</code> using this cloneCollection syntax via command line?</p>