the aggregation operation here collects the values form the collection and perform the methods that are predefined in mongodb:
we use aggregate(). the below are some of the aggregate functions:
$sum: sums up the value of the documents in the collection.
$min:gets the minimum value from the values of the document in collection.
$max:gets the maximum value from the values of the document in collection.
$first:gets the first record from the documents according to the grouping.
$avg: to calculate the average of all the values in the document.
$push:inserts a value in the array of the document.
$addToSet: insert the value in the array of the document but does not insert the duplicate documents.
$last:gets the last record from the document according to the grouping.
some of the key commands that makes the query more efficient by binding the aggregate functions to them. the following are the list:
$project : only specific fields can be selected
$match:
$group: the actual aggregation function for grouping.
$sort: sorting of the document
$skip:with in the available documents we can go to the list of the documents or needed documents.
$limit:this is the limitation on the documents that how many to be searched for.
$unwind: when an embeded document is present in the collection, it makes the relation as a join. so in order to use it as a independent document we have to use $unwind.
we use aggregate(). the below are some of the aggregate functions:
$sum: sums up the value of the documents in the collection.
$min:gets the minimum value from the values of the document in collection.
$max:gets the maximum value from the values of the document in collection.
$first:gets the first record from the documents according to the grouping.
$avg: to calculate the average of all the values in the document.
$push:inserts a value in the array of the document.
$addToSet: insert the value in the array of the document but does not insert the duplicate documents.
$last:gets the last record from the document according to the grouping.
some of the key commands that makes the query more efficient by binding the aggregate functions to them. the following are the list:
$project : only specific fields can be selected
$match:
$group: the actual aggregation function for grouping.
$sort: sorting of the document
$skip:with in the available documents we can go to the list of the documents or needed documents.
$limit:this is the limitation on the documents that how many to be searched for.
$unwind: when an embeded document is present in the collection, it makes the relation as a join. so in order to use it as a independent document we have to use $unwind.
No comments:
Post a Comment