Chapter 8. Working with basic query operators

 

This chapter covers

  • Mapping and transforming the notification datum
  • Filtering and choosing which notifications to observe
  • Creating observables of distinct items
  • Aggregating and quantifying notifications

After a source observable emits a notification, there’s often a pipeline the notification goes through before it reaches the destined observer. Almost every example in this book shows how operators are used in some way to manipulate a generated sequence of notifications, which your observers eventually observe. This chapter categorizes and explains the basic operators that you’ll use to create queries on the observables at hand. These include transformations and mappings, filtering and flattening, and aggregation operators that generate sums, averages, and other types of quantifiable results, as shown in figure 8.1. Some of the operators shown in this chapter were introduced in previous chapters, but you haven’t yet seen how they’re defined and the capabilities they provide.

Figure 8.1. Example of an observable pipeline. Each block may or may not be present, and the order of blocks may change as well. Sometimes one type of block may be present more than once.

8.1. Selecting what’s important (mapping)

8.2. Flattening observables

8.3. Filtering an observable

8.4. Aggregating the observable sequence

8.5. Summary