Drupal provides mechanisms to support different database storage backends that are not provided by the Drupal core, such as MongoDB. Although it is not stable for Drupal 8 at the time of writing this book, there is a MongoDB module that provides storage interaction.
The module provides \Drupal\mongodb\Entity\ContentEntityStorage, which extends \Drupal\Core\Entity\ContentEntityStorageBase. This class overrides the methods used to create, save, and delete, to write them to a MongoDB collection.
The project can be found at https://www.drupal.org/project/mongodb.
While there are much more steps to provide a custom storage backend for content entities and their fields, this serves as an example for how you can choose to place a custom entity in different storage backends.