Let's take a few minutes talk about the structure and syntax the aggregation framework. The aggregation framework has a simple and reliable structure and repeatable syntax. Pipelines may contain one or more stages. Each stage is adjacent object of key-value pairs with only a few exceptions, we can have as many stages as we like. Additionally, options may be passed in. For example, specifying whether to allow disk use for large aggregations or to build the explained plane of the aggregation to see whether it is using indexes or the server optimize the pipeline. Let's take a look at a very simple but very real pipeline and discuss the syntax. Here we have a mash stage that checks whether the atmospheric composition contains oxygen or not and if the mean temperature falls within this range. Then, we have a project stage that reshapes the document and calculates the new value. More on this in a moment. Lastly, this is our options object. Each stage is composed of either operators or expressions. As we continue through the course, you'll be introduced to many of these. Make sure you bookmark the aggregation pipeline quick reference pages link below this video. Throughout the course, we'll be using the terms operator and expression. And it's vitally and quickly access the documentation for these. So what's an operator? For this course, when we say operators, we mean either query operators or aggregation stages. In this example, "$match" and "$project" are aggregation operators, and "$in", "$gte", and "$lte" are query operators. As a general rule, operators always appear in the key position of a document. "$match" is a little special and we'll learn about it later. What's an expression? Expressions act a lot like functions, we provide arguments and they provide a computed output. And just like functions, expressions can be composed to form powerful new data transformations. MongoDB provides expressions for working with them producing values from many types of values. In the project stage, "$gt" is an expression and its arguments are supplied in this array. This "$numberOfMoons" surrounded by the quotes is also an expression that you'll learn about in a moment. An easy way to remember how to use expressions is they will always appear in a value position. Let's run this now to see the output. Here we see the result of the calculated field. It looks like Earth is the only planet that has oxygen as a relatively comfortable temperature and it does indeed have moons. One more important thing to cover. We may encounter syntax like this. The first is a field path expression, is used to access the value of a field in the document, like number of moons in the first example. The second, with two dollar signs followed by an uppercase word, is a system-level variable. "$current" refers to the current document and you can find the meaning of others on the quick reference page. The last with two dollar signs followed by lowercase word is a user variable. Some expressions let us temporarily bind a value to a name or provide us a special name to access some data. And there we go. The aggregation framework structure and syntax. We highly recommend using nattered that has bracket matching while constructing your pipelines to make noticing errors easier. There's just a few things to remember. Pipelines are always an array of one or more stages. Stages are composed of one or more aggregation operators or expressions. Expressions may take a single argument or an array of arguments. See you in the next lesson.