Aggregation Operations Flashcards
1
Q
Which operation is used to select specific documents?
A
{ $match: {find obj} }
2
Q
Which operation is used to sort documents?
A
{ $sort: {attr: 1/-1} }
3
Q
Which operation is used to add fields to documents?
A
{ $addFields: {fieldName: ‘$_attr’} }
4
Q
Which operation is used to specify the number of documents to return?
A
{$limit: val}
5
Q
Which operation is used to remove attributes from documents?
A
{ $project: {attr: 0} }
6
Q
Which operation is used to transform documents into the first normal form?
A
{ $unwind: ‘$attr of focus’ }
7
Q
Which operation is used to group documents when performing operations?
A
{ $group: {attrName: groupfunctions} }
8
Q
What are some commonly used group functions?
A
- $sum/$avg/$min/$max: ‘$attr’ 2.$add/$multiply/$subtract/$divide: [‘$attr’, ‘attr’]