Community contributed extensions

PlayMorphia module Documentation

IMPORTANT NOTE for those who use Long type ID: There is an urgent issue reported by Peksa: Version 1.2.11 and up reset Long id generation in production system

Welcome to PlayMorphia module documentation. This documentation is intended for the 1.2.11 release and may significantly differ from previous module version’s documentation.

Check the version history

Break changes: Start from v1.2.8 Auto timestamp feature enabled to all Model classes by default. Add the following line to your conf/application.conf file to maintain the compatibility to your existing project: morphia.autoTimestamp=false

Break changes: v1.2.7 now works for Play-1.2.4+. If you are still using Play-1.2.3 or below, please use v1.2.6a instead.

Getting started

Your first steps with PlayMorphia module and your first 5 minutes of fun.

  1. PlayMorphia Features
  2. PlayMorphia overview
  3. Frequently Asked Questions
  4. Installation and Configuration

  1. Watch the screencast
  2. Five cool things you can do with PlayMorphia
  3. Your first application —— the ‘Hello World’ tutorial
  4. Sample applications

Tutorials — PlayMorphia guide, adapt YABE from JPA to PlayMorphia

Learn PlayMorhpia by adapting Play’s YABE sample application from JPA to PlayMorphia.

This section is under construction. For the moment, check the YABE sample application released along with the plugin, read the source code, and run the test.

The essential documentation

Everything you need to know about PlayMorphia

  1. Getting started
    1. Installation
    2. Configuration
  2. Main concepts
    1. Understand mongodb
    2. Understand morphia, the Object-Document-Mapping tool
    3. PlayMorphia, integrate morhpia/mongodb into Play's DB model
  3. PlayMorphia model
    1. Model basic
    2. Embedded entity
    3. Reference other models
    4. Store blob data into GridFS
    5. Automatic timestamp
    6. Create index
    7. Advanced Model topics
  4. Use PlayMorphia model in your application
    1. Create an new model instance
    2. Read from mongodb
    3. Check if an model instance is new or existing data
    4. Update model
    5. Delete model
  5. Using query
    1. 30 seconds tutorial
    2. Build MorphiaQuery object
    3. Specify query criteria
      1. Text search with regular expression
      2. OR query
      3. Query embedded object
      4. Query referenced object
    4. Fetch entities from MorphiaQuery
      1. Limit the number of records returned
      2. Skip the first N number of records
      3. Sort records in the returned list
      4. Get one record only
    5. Aliases of query methods
  6. Advanced topics
    1. Advanced PlayMorphia Models
    2. Statistics: aggregation and grouping
    3. Cloud: calculate tag weight
    4. Handle lifecycle events
    5. Atomic update operations

  1. Play integration
    1. CRUD Support
    2. Lifecycle events
    3. Morphia Fixture


  1. Configuration
  2. Annotations