Aggregation Operations Flashcards

1
Q

Which operation is used to select specific documents?

A

{ $match: {find obj} }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which operation is used to sort documents?

A

{ $sort: {attr: 1/-1} }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which operation is used to add fields to documents?

A

{ $addFields: {fieldName: ‘$_attr’} }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which operation is used to specify the number of documents to return?

A

{$limit: val}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which operation is used to remove attributes from documents?

A

{ $project: {attr: 0} }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which operation is used to transform documents into the first normal form?

A

{ $unwind: ‘$attr of focus’ }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which operation is used to group documents when performing operations?

A

{ $group: {attrName: groupfunctions} }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are some commonly used group functions?

A
  1. $sum/$avg/$min/$max: ‘$attr’ 2.$add/$multiply/$subtract/$divide: [‘$attr’, ‘attr’]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly