Chapter 16. NoSQL and Grails


This chapter covers

  • Why NoSQL is worth considering
  • How GORM interacts with NoSQL stores
  • Key/value stores with Redis
  • Document-oriented data storage with MongoDB
  • Graph databases with Neo4J

In chapter 15, you worked on events, messaging, and scheduling tasks. In this chapter we take you on a tour of all the popular Grails NoSQL solutions, and give you a good sense of what makes sense where. You also learn how your relational and NoSQL data can happily co-exist (remembering that NoSQLstands for Not Only SQL). By the end of this chapter, you’ll understand the brave and shiny new world of NoSQL solutions and know which ones are worth exploring in your next enterprise project.

16.1. The problem with PostgreSQL (or when to choose NoSQL)

You’ve used GORM with our favorite relational databases throughout the entire book, so why bother to look elsewhere? We hear you. There’s a huge amount to be said for sticking with workhorse technologies that are battle-tested and proven in the real world. Relational technology has been with us since Codd and Date’s work in the 1960s, and we’ve all had professional experience with modern, fast relational databases. There’s nothing wrong with using PostgreSQL—we highly recommend it if it suits your data storage needs. And then there’s the catch...

16.2. Types of NoSQL databases (and typical use cases table)

16.3. Using Redis to work with key-value stores

16.4. Using MongoDB to work with document-oriented data

16.5. Using Neo4j to work with graph-oriented data

16.6. Summary and best practices