Week 3 L1 Flashcards
What are aggregation methods ? Give some examples of what they do
The grouping of values from multiple records together to return computed results rather than raw data. For example results such as sum, average, maximum, minimum.
What are the three aggregation methods in MongoDB?
Single purpose aggregation operations(simple but very limited)
Aggregation pipelining (more efficient but limitations)
Map reduce programming - flexible but more complicated
What model works well across a cluster?
Distributed processing model
What are the two built-in mongo db operations that are single purpose aggregation ?
Count, Distinct(returns array of value with no duplicates)
What is a aggregation pipeline and what are its stages(not operations)
A sequence of stages/processes Transform or reshape data Filter Data Group and sort data Calculate data such as sum or average
What are the aggregation operators used in a pipe line ?
Project, Match, Group, Sort, Limit , Unwind
What is a field path and when are they used?
Field path used to access fields within documents in aggregate pipleine. prefixed by a dollar sign
What are the three possible stages of map reduce programming
Map, reduce, finalise
What are they key features of the map function
No parameters and no return value
Called with every document in query result set
Accesses each doc via variable called “this”.
Produces a new document by calling emit.
What must emitted docs be ?
Key: Value pairs
What are they key features of the reduce function?
Function reduces the value array for each grouped key to a single object.
Calculation is on all of values in array ( for given key)
Can be simple like sum or something more complex such as finalize function
What are the parameters of the reduce function
Key and array of values from map function
What does finalise function output
Outputs computation across the members of the value object
What are the parameters of the finalise function
Key and array of values from reduce function
What is the purpose of the query map reduce operation
To limit the documents processed