title: correcly using allow_disk_usage with pymongo
body: <p>I have an object that run fine for smaller collections, however my collection is big with over about 7 million documents. I am essentially trying to group by key, key1 and key2</p>
  <pre><code>def groupByThreeItems(self, db=None, col=None, key=None, key1=None, key2=None):
      coll=self.client_()[db][col]
      
      agg_result= coll.aggregate([{
         '$group':
           {'_id': { key: &quot;$&quot;+key, key1: &quot;$&quot;+key1},
             key2: { &quot;$push&quot;:  &quot;$&quot;+key2 }, &quot;Count&quot;:{&quot;$sum&quot;: 1}
           }}],{'allow_disk_use': True})
      return [i for i in agg_result]
  </code></pre>
  <p>I get the following error</p>
  <pre><code>AttributeError: 'dict' object has no attribute '_txn_read_preference'
  </code></pre>
  <p>However, when I do not use the allow_disk_use, I get following error.</p>
  <pre><code>pymongo.errors.OperationFailure: Exceeded memory limit for $group, but didn't allow external sort. Pass allowDiskUse:true to opt in., full error: {'ok': 0.0, 'errmsg': &quot;Exceeded memory limit for $group, but didn't allow external sort. Pass allowDiskUse:true to opt in.&quot;, 'code': 292, 'codeName': 'QueryExceededMemoryLimitNoDiskUseAllowed'}
  </code></pre>
  <p><strong>How do I solve the disk usage error to allow me use the aggregation framework?</strong></p>