title: Using --rest with MongoDB's mongos
body: <p>I've created a small MongoDB v2.6.4 cluster with one <strong>mongos</strong> router, three config servers, and handful of <strong>mongod</strong> data servers.  It's working fine, I can do CRUD operations just fine from the mongos client, which directs to the appropriate shards.</p>
  
  <p>I'm now wanting to experiment with the rest service.</p>
  
  <p>When I tried this with a single MongoDB data server using <strong>mongod</strong>, it worked exactly as prescribed.</p>
  
  <p>Even now, I can connect to each shard which is running with <code>--rest</code> and get a web response.  But, the results are a little unexpected. I see the overview, clients, dbtop, write lock, log, etc. And if I click on listDatabase, I actually see my database listed.  However, any REST attempts I try return with a JSON object showing offest 0, no rows, total of 0 roes, no query, and 0 milliseconds.  </p>
  
  <p>At the moment I'm of the opinion that this doesn't matter, as I've directly connected to a shard and would anticipate only seeing just the contents of that shard -- although further experimentation has been unable to produce even that result.</p>
  
  <p>Again, I'll stress that in the current sharded configuration, <strong>mongos</strong>, NodeJS, and PHP all can see, query, and manipulate the data within my MongoDB collection just fine.</p>
  
  <p>However, what I'm trying to do (if it's even possible) is connect to the <code>mongos</code> shard service via REST, since it does offer the <code>--httpinterface</code> option, figuring it will expose access to the shards and do the right thing.</p>
  
  <p>It delivers the standard status page, but clicking on any links or hand rolling any REST results in a message about <code>--rest</code> not being enabled and that I should enable it.</p>
  
  <pre><code>REST is not enabled, use --rest to turn on.
  check that port 28017 is secured for the network too.
  </code></pre>
  
  <p>Problem is, <strong>mongos</strong> doesn't allow that as an option! &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;(<em>mongod, however does</em>)</p>
  
  <ol>
  <li>It is entirely possible this is correct behavior, but I'm not sure how REST services would then work in a sharded configuration.</li>
  <li>I'm not using a configuration file, specifying everything by the command line. That said, I tried passing a config file with <code>RESTInterfaceEnabled: true</code> in the yaml, and it didn't help.</li>
  <li>mongos is returning a web interface, with the List all commands, db version, and log.  It's missing the other diagnostic information (that's usually mongod specific), which I'd perhaps expect.  But the links it offers doesn't work -- all requesting me to turn on an option that isn't there.</li>
  <li>I've manually checked each shard data server (running mongod with <code>--shardsvr</code>), and directly connecting to them <em>does</em> provide REST access.</li>
  <li>Everything else about the sharded cluster is working perfectly.  I just can't to REST, like I can in a single-node unsharded solution and access my database or collections.</li>
  </ol>
  
  <p>What might I have missed?  Is this even possible?  Any ideas?</p>