title: pymongo: findandmodify - "no such command" is returned
body: <p>I believe there is a bug in pymongo (or, at least, the documentation) which makes it impossible to run a <code>findandupdate</code> query.</p>
  
  <p>Here's what happens. When I run:</p>
  
  <pre><code>    result = db.command({
          'findandmodify': 'my_collection',
          'query': {'foo': 'bar'},
          'update': {'$set': {'status': 'queued'}},
      })
  </code></pre>
  
  <p>The query that actually gets sent to the server is:</p>
  
  <pre><code>{ 'query': {'foo': 'bar'}, 'findandmodify': 'my_collection', … }
  </code></pre>
  
  <p>Note that the <code>query</code> argument is <em>first</em>, and <code>findandmodify</code> is <em>second</em>.</p>
  
  <p>But this causes the server to throw up:</p>
  
  <pre>OperationFailure: command { 'query': {'foo': 'bar'}, 'findandmodify': 'my_collection', … } failed: no such cmd</pre>
  
  <p>Because the server expects <code>findandmodify</code> to be first (BSON dicts are, apparently, ordered).</p>
  
  <p>Is there any work around for this?</p>