June 2017
Intermediate to advanced
400 pages
10h 32m
English
When working with external storage interfaces, it can be helpful to abstract your operations behind an interface. This is for ease of mocking, portability in case you change storage backends, and isolation of concerns. The downside to this approach may come if you need to perform multiple operations inside of a transaction. In that case, it makes sense to make composite operations, or to allow it to be passed in via a context object or additional function arguments.
This recipe will implement a very simple interface to working with items in MongoDB. These items will have a name and price and we'll use an interface to persist and retrieve these objects.
Read now
Unlock full access