In this chapter, you learned how to create a set of database classes that can then be used throughout your application. The Connection class provides access to a pymongo.mongo_client.MongoClient instance, from which you can access a database and collection. You then learned how to define domain service classes, each of which provides methods that are pertinent to a MongoDB collection. In many cases, these classes provide wrappers for various pymongo.collection.Collection.* methods, including find(), find_one(), update_one(), update_many(), insert_one(), insert_many(), delete_one(), and delete_many().
You were then shown how to model a query first in the mongo shell using JavaScript and then how to adapt it to Python using the domain services classes. First, you learned how to generate a product sales report. Then, you were shown how to use the domain service classes to update a product.
Finally, the last two sections introduced a set of classes that provide support for a...