title: How to copy part of a collection from a remote server to a local database in MongoDB
body: <p>I am new to MongoDB, so I'm probably just missing something simple. A remote server has a MongoDB database called <code>DatabaseABC</code> which has a collection called <code>Logger</code>. This collection is humongous. I figured the best way to understand how to query against it without having to wait several minutes between queries was to copy the last day's worth of documents in the collection locally.</p>
  
  <p>From what I've read, I should be able to use <a href="http://docs.mongodb.org/manual/reference/command/cloneCollection/#dbcmd.cloneCollection" rel="nofollow">cloneCollection</a> and give it a query to filter it down. I can't get it to work. The documentation says, </p>
  
  <blockquote>
    <p>You must connect directly to the mongod instance.</p>
  </blockquote>
  
  <p>but I don't understand what that means. How do I connect to a local database using <code>mongod</code>? <code>mongod</code> seems like a way to start a database, I can do that, but I don't get how to run <code>{ cloneCollection: "DatabaseABC.Logger", from: "mongoDevEtc.domain.net:27017", query: { TheTimestamp: "2015-05-13" } }</code> with it.</p>
  
  <p>I need baby steps. Assume I have a local database called <code>test</code>. I have a fresh Microsoft Windows command prompt open pointed at the bin directory where mongod.exe exists. What commands do I enter in order to move all the logs written on May 13, 2015 from <code>mongoDevEtc.domain.net:27017.DatabaseABC.Logger</code> to my local collection at <code>127.0.0.1:21000.test.Logger</code> (note, the logger collection doesn't exist locally yet)?</p>