Bavarian government runs a document template application (RTF or ODF with Groovy, Python, Ruby or Tcl as scripting language) serving different government offices. Having complex and hierarchical data structures to organize the templates, MongoDB was selected to replace the Oracle-based persistence layer. This presentation is about the improvements they have achieved with the migration to MongoDB, problems they had to solve underway and unit testing of the persistence layer in order to keep their quality level. Presentation slides by Christian Brensing, Senior Developer at Rechenzentrum Süd, shown at Munich MongoDB User Group Meetup on 18th September 2012
3. • Template-Processor (~ JSP)
• ODF and RTF
• PDF / PostScript postprocessing
• Groovy, Python, Ruby, Tcl
• In Production using RDBMS
since 2008
• Central HR system (SAP) uses
BayText to create output
18. public class RoleReadConverter implements Converter<DBObject, Role> {!
@Override!
public Role convert(DBObject source) {!
Role role = new Role();!
role.setName((String) source.get("name"));!
...!
return role;!
}!
}!
!
!
public class RoleWriteConverter implements Converter<Role, DBObject> {!
@Override!
public DBObject convert(Role source) {!
return new BasicDBObject()!
.append("name", role.getName())!
.append(...);!
}!
}!
!
!
// Convert a DBObject to an Entity!
conversionService.convert(collection.findOne(...));
Easy mapping using Spring-ConversionService
25. But paths are mutable!
All references must be updated
26. Approach
• Pseudo-Transaction with an update locking
mechanism in a custom oplog collection
• Periodical repair jobs finishing cancelled
operations
• Extended interpretation of eventual consistency
35. Summary
• Developing the data layer is fun again
• Reduced complexity
• Flat learning curve compared to SQL/ORM
• use_mongo() unless transactions_required