Databases

Volume I - LevelDB, Redis and CouchDB

by Pedro Teixeira


ABOUT THE BOOK

Node.js has been designed to do quick and efficient network I/O. It's event-driven streams make it ideal to be used as a kind of smart proxy, often working as the glue between back-end systems and clients. Node was originally designed with that intention in mind, but meanwhile it also has been successfully used to build traditional web applications: an HTTP server that serves HTML pages or replies JSON messages and uses a database to store the data. Even though web frameworks in other platforms and languages have preferred to stick with traditional open-source relational databases like MySQL or PostgreSQL, most of the existing Node web frameworks (like Express, Hapi and others) don't impose any database or even any type of database at all. This bring-your-own-database approach has been in part fed by the explosion in the variety of database servers now available, but also by the ease with which the Node module system and NPM allow you to install and use third-party libraries.

In this book we will analyze some of the existing solutions for interacting with some types of databases and what interesting uses can you give them. This first short book on databases starts with some of my favourites: LevelDB, Redis and CouchDB.

131 pages

Contents:

  • An embedded database using LevelDB
    • Installing LevelDB
    • Using LevelDB
    • Encodings
    • Using JSON forencoding values
    • Batch operations
    • Using a readable stream
    • Using ranges
    • ...
  • Redis
    • Redis Primitives
    • Strings
    • Key expiration
    • Transactions
    • Command results in Multi
    • Optimistic locking using WATCH
    • Transactions using Lua scripts
    • Caching Lua scripts
    • ...
  • CouchDB
    • Starting off
    • Ladies and Gentlemen, start your Nodes
    • Overriding the HTTP agent socket pool
    • The directory structure
    • Creating a documents with a specific ID
    • Forcing a Schema
    • Unifying errors
    • ...

Price: $9.00 + VAT

ABOUT THE AUTHOR

Pedro Teixeira is a geek, programmer and entrepreneur. He's also the author of some Node modules, the Hands-on Node.js e-book, the Professional Node.js book and is an overall fervent proclaimer of the Node.js creed. Organiser of LXJS, the Lisbon JavaScript Conference. Partner at YLD.
FREE

Pedro Teixeira

Modules

Understanding and using the Node module system

Pedro Teixeira

Flow Control

Mastering asynchronous flow control in Node

Pedro Teixeira

Work Queues

Master Deferred and Distributed Work in Node

Pedro Teixeira

Configuration

How to efficiently distribute the configuration of your Node processes

Pedro Teixeira

Networking

How to escape the trap of monolithic apps using Node

Pedro Teixeira

Databases

Volume I - LevelDB, Redis and CouchDB