(Quick Reference)

1 Introduction - Reference Documentation

Authors: Graeme Rocher, Burt Beckwith

Version: 3.0.0

1 Introduction

MongoDB bridges the gap between key-value stores (which are fast and highly scalable) and traditional RDBMS systems (which provide rich queries and deep functionality).

MongoDB (from "humongous") is a scalable, high-performance, open source, document-oriented database.

This project aims to provide an object-mapping layer on top of Mongo to ease common activities such as:

  • Marshalling from Mongo to Groovy/Java types and back again
  • Support for GORM dynamic finders, criteria and named queries
  • Session-managed transactions
  • Validating domain instances backed by the Mongo datastore

1.1 Compatibility with GORM for Hibernate

This implementation tries to be as compatible as possible with GORM for Hibernate. In general you can refer to the GORM documentation and the "Domain Classes" section of the reference guide (see the left nav) for usage information.

The following key features are supported by GORM for Mongo:

  • Simple persistence methods
  • Dynamic finders
  • Criteria queries
  • Named queries
  • Inheritance
  • Embedded types
  • Query by example

However, some features are not supported:

  • HQL queries
  • Composite primary keys
  • Many-to-many associations (these can be modelled with a mapping class)
  • Any direct interaction with the Hibernate API
  • Custom Hibernate user types (custom types are allowed with a different API)

There may be other limitations not mentioned here so in general it shouldn't be expected that an application based on GORM for Hibernate will "just work" without some tweaking involved. Having said that, the large majority of common GORM functionality is supported.

1.2 Release Notes

Below are the details of the changes across releases:


  • Support for MongoDB 2.6
  • MongoDB 2.6 GeoJSON type support (MultiPoint, MultiLineString, MultiPolygon and GeometryCollection)
  • Support for Maps of embedded entities
  • Flexible index definition
  • Full text search support
  • Support for projections using MongoDB aggregation
  • Size related criteria implemented (sizeEq, sizeLt etc.) on collections


  • GeoJSON shape support
  • Support for SSL connections
  • Support for MongoDB connection strings


  • Support for stateless mode to improve read performance
  • Support for dynamically switching which database or collection to persist to at runtime


MongoDB plugin 1.2 and above requires Grails 2.1.5 or 2.2.1 as a minimum Grails version, if you are using older versions of Grails you will need to stay with 1.1

1.1 GA

  • DBRefs no longer used by default for associations
  • Upgrade to GMongo 1.0 and Spring Data MongoDB 1.1
  • Support for global mapping configuration

1.0 GA

  • Initial feature complete 1.0 release