Notice: session_start(): A session had already been started - ignoring in /home/u614325693/domains/onedoubt.com/public_html/post.php on line 3
$group - ONEDOUBT.COM

 

Aggregation $group

This aggregation stage groups documents by the unique _id expression provided.

Don't confuse this _id expression with the _id ObjectId provided to each document.

Example

In this example, we are using the "sample_airbnb" database loaded from our sample data in the section.

db.listingsAndReviews.aggregate(
    [ { $group : { _id : "$property_type" } } ]
)

This will return the distinct values from the property_type field.


 
$group

Login
ADS CODE