title: How to restore a single mongodb database with oplogReplay?
body: <p>I'm having trouble finding if this is even a supported operation. I found things that suggest it didn't use to be, but I'm not getting any logs that indicate it's not supported (just confusing logs) and I wasn't able to find anything in mongo's docs that indicate it's not allowed.</p>
  
  <p>For reference:</p>
  
  <ul>
  <li>OS: Centos6.6</li>
  <li>Mongod: v3.0.2</li>
  <li>Mongo Shell: v3.0.2 </li>
  <li>Mongodump: v3.0.2</li>
  <li>Mongorestore: v3.0.2</li>
  </ul>
  
  <p>Here's the command I'm running to create my dump (I am using auth):</p>
  
  <pre><code>mongodump -u username -p password --authenticationDatabase admin --oplog
  </code></pre>
  
  <p>Here's the original file structure after a dump.</p>
  
  <pre><code>└── dump
      ├── oplog.bson
      ├── admin
      │   ├── system.users.bson
      │   ├── system.users.metadata.json
      │   ├── system.version.bson
      │   └── system.version.metadata.json
      ├── dogs
      │   ├── tails.bson
      │   └── tails.metadata.json
      └── mydata
          ├── objects.bson
          ├── objects.metadata.json
          ├── fs.chunks.bson
          ├── fs.chunks.metadata.json
          ├── fs.files.bson
          ├── fs.files.metadata.json
          ├── configuration.bson
          └── configuration.metadata.json
  </code></pre>
  
  <p>I've tried a few different variations of restore to get what I want, but they each seem a little off. After reading the following in mongo's docs concerning mongorestore:</p>
  
  <blockquote>
    <p>--db does not control which BSON files mongorestore restores. You must use the mongorestore path option to limit that restored data.</p>
  </blockquote>
  
  <p>it seems to me that I should be able to copy the oplog.bson into the particular database's folder that I want to restore and then run the following from inside dump/:</p>
  
  <pre><code>mongorestore -u username -p password --authenticationDatabase admin --oplogReplay --db dogs dogs
  </code></pre>
  
  <p>I found this confusing because it gives these logs:</p>
  
  <pre><code>2015-05-13T22:10:12.694+0000    building a list of collections to restore from dogs dir
  2015-05-13T22:10:12.695+0000    reading metadata file from dogs/tails.metadata.json
  
  2015-05-13T22:10:12.695+0000    restoring dogs.oplog from file dogs/oplog.bson
  2015-05-13T22:10:12.696+0000    no indexes to restore
  2015-05-13T22:10:12.696+0000    finished restoring dogs.oplog
  
  2015-05-13T22:10:12.696+0000    restoring dogs.tails from file dogs/tails.bson
  2015-05-13T22:10:12.697+0000    restoring indexes for collection dogs.tails from metadata
  2015-05-13T22:10:12.697+0000    finished restoring dogs.tails
  
  2015-05-13T22:10:12.697+0000    replaying oplog
  2015-05-13T22:10:12.697+0000    no oplog.bson file in root of the dump directory, skipping oplog application
  
  2015-05-13T22:10:12.697+0000    done
  </code></pre>
  
  <p>The first part about dogs.oplog makes it seem as if things are working, however the later message about oplog confuses me.</p>
  
  <p>No matter which variations of directories and paths that I try I can't seem to satiate this message in particular:</p>
  
  <pre><code>2015-05-13T22:10:12.697+0000    replaying oplog
  2015-05-13T22:10:12.697+0000    no oplog.bson file in root of the dump directory, skipping oplog application
  </code></pre>
  
  <p>Does this mean my oplog replay isn't happening? Is my point-in-time backup / restore still doing what I expect? I recall seeing some tickets about improving the log messages of mongotools, perhaps this is just poor logging?</p>