Mongo $group with $project
<p>I am trying to get keyword count along with <code>parentId</code>, <code>categioryId</code> and <code>llcId</code>.
My db is </p>

<pre><code>{
    "_id" : ObjectId("5673f5b1e4b0822f6f0a5b89"),
    "keyword" : "electronic content management system",
    "llcId" : "CL1K9B",
    "categoryId" : "CL1K8V",
    "parentId" : "CL1K8V",

}
</code></pre>

<p>I tried <code>$project</code> with <code>$group</code></p>

<pre><code>db.keyword.aggregate([
    {
        $group: {
            _id: "$llcId",
            total: {$sum: 1},
        }
    },
    {
        $project: {
            categoryId: 1, total: 1
        }
    }
])
</code></pre>

<p>And it gives me a result like </p>

<pre><code>{ "_id" : "CL1KJQ", "total" : 17 }
{ "_id" : "CL1KKW", "total" : 30 }
</code></pre>

<p>But I need actual data in result also e.g. <code>llcId</code>, <code>categoryId</code>, <code>keyword</code>, <code>total</code>. I tried to display <code>cetgoryId</code> and keyword by using <code>$project</code> but it displays only <code>_id</code> and total. What I am missing?</p>