find all data with group by in mongoose
<p>How to perform this query in mongoose 
i have found some example but i could not find solution for this </p>

<pre><code>select * from table group by name
</code></pre>

<p>I have tried this </p>

<pre><code> table.aggregate([
        {
            $group: {
                _id: '$name',                
            }
        }
    ], function (err, d) {
        if (err) {
           console.log(err);
        } else {
            console.log(JSON.stringify(d));
        }
    });
</code></pre>

<p>But it shows only name not all data </p>