title: How to do "group by" in mongoengine
body: <p>Suppose my Schema looks like so:</p>
  
  <pre><code>class User(Document):
    username = StringField()
    password = StringField()
    category = StringField()
  </code></pre>
  
  <p>Imagine we have these existing categories: <code>"avengers", "justice-leaguers", "villains"</code>, and I want to perform a <code>"group by"</code> query for <code>User.objects.all()</code> so that I can get something like this:</p>
  
  <pre><code>[
   [&lt;User: IronMan object&gt;, &lt;User: Thor object&gt;, &lt;User: Hulk object&gt;], 
   [&lt;User: Superman object&gt;,&lt;User: Batman object&gt;], 
   [&lt;User: Ultron object&gt;, &lt;User: Joker object&gt;, &lt;User: LexLuthor object&gt;]
  ]
  </code></pre>
  
  <p>Or better yet: </p>
  
  <pre><code>{
   "avengers": [&lt;User: IronMan object&gt;, &lt;User: Thor object&gt;, &lt;User: Hulk object&gt;], 
   "justice-leaguers": [&lt;User: Superman object&gt;,&lt;User: Batman object&gt;], 
   "villains": [&lt;User: Ultron object&gt;, &lt;User: Joker object&gt;, &lt;User: LexLuthor object&gt;]
  }
  </code></pre>
  
  <p>I looked into MongoEngine's docs and have yet to find anything helpful. Thanks guys! </p>