Chapter 4. Interfacing with Databases

In this chapter we will cover:

  • Writing to a CSV file
  • Connecting and sending SQL to a MySQL server
  • Storing and retrieving data with MongoDB
  • Storing and retrieving data with Mongoskin
  • Storing data to CouchDB with Cradle
  • Retrieving data from CouchDB with Cradle
  • Accessing CouchDB changes stream with Cradle
  • Storing and retrieving data with Redis
  • Implementing PubSub with Redis

Introduction

As the complexity of our code and the demands of our objectives increase, we soon realize the need for a place to store our data.

We then have to ask the question: What is the best way to store our data? The answer depends on the type of data we are working with since different challenges require different solutions.

If we're doing something ...

Get Node Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.