Andreas Arledal

Writing about Groovy and Grails.

Gr8 Expectations

It’s a little late for new years resolutions, but I have some promises to myself for this year strongly connected to this blog and my life as a developer. One of my biggest goals for the year is to take the next step in being a more active contributor to the groovy and grails community. To put the pressure on myself I decided to share those goals here, so here they are:

Grails mongoDB - Collections of DBRefs Inside an Embedded Collection

I’m working on a project where we’re migrating from MySQL to mongoDB. One of the reasons for the switch is that the use of embedded collections will simplify our model and make it more efficient. The official mongodb-plugin (1.0.0.RC1) has some problems before it will be ready for production though. One of the problems is that having an embedded collection referencing another collection isn’t possible with GORM (GPMONGODB-92). The workaround is to use the Low-level API instead of GORM. Here’s a simple example where a building has many offices and the offices has companies, but the companies need to be in an own collection since we need the possibility to query them specificaly.