Lightbend Activator

ReactiveMongo Play Autosource

Activator will be EOL-ed on May 24, 2017.

We’re making it easier and simpler for developers to get started with Lightbend technologies. This unfortunately means that future releases of Play, Akka and Scala will no longer include Activator support, and Lightbend’s Activator server will be decommissioned by the end of 2017. Instead of supporting Activator to create and set up development projects, we'll be supporting standard Giter8 templates for sbt users and Maven archetypes for Maven users. So going forward,

To create new Lightbend projects

Instead of using the Activator command, make sure you have sbt 0.13.13 (or higher), and use the “sbt new” command, providing the name of the template. For example, “$ sbt new akka/hello-akka.g8”. You can find a list of templates here.

Also, as a convenience, the Lightbend Project Starter allows you to quickly create a variety of example projects that you just unzip and run.

To create new templates

If you want to create new templates, you can now do that in Giter8.

To migrate templates from Activator to Giter8

If you created Activator templates in the past, please consider migrating them to Giter8 with this simple process.

ReactiveMongo Play Autosource

July 16, 2013

A template for ReactiveMongo Play Autosource - Automatic CRUD/REST Datasource.

How to get "ReactiveMongo Play Autosource" on your computer

There are several ways to get this template.

Option 1: Choose activator-play-autosource-reactivemongo in the Lightbend Activator UI.

Already have Lightbend Activator (get it here)? Launch the UI then search for activator-play-autosource-reactivemongo in the list of templates.

Option 2: Download the activator-play-autosource-reactivemongo project as a zip archive

If you haven't installed Activator, you can get the code by downloading the template bundle for activator-play-autosource-reactivemongo.

  1. Download the Template Bundle for "ReactiveMongo Play Autosource"
  2. Extract the downloaded zip file to your system
  3. The bundle includes a small bootstrap script that can start Activator. To start Lightbend Activator's UI:

    In your File Explorer, navigate into the directory that the template was extracted to, right-click on the file named "activator.bat", then select "Open", and if prompted with a warning, click to continue:

    Or from a command line:

     C:\Users\typesafe\activator-play-autosource-reactivemongo> activator ui 
    This will start Lightbend Activator and open this template in your browser.

Option 3: Create a activator-play-autosource-reactivemongo project from the command line

If you have Lightbend Activator, use its command line mode to create a new project from this template. Type activator new PROJECTNAME activator-play-autosource-reactivemongo on the command line.

Option 4: View the template source

The creator of this template maintains it at

Option 5: Preview the tutorial below

We've included the text of this template's tutorial below, but it may work better if you view it inside Activator on your computer. Activator tutorials are often designed to be interactive.

Preview the tutorial

You've just created a simple Play application providing a usable Play Autosource for ReactiveMongo.
With it, you can bootstrap in a few lines an automatic CRUD asynchronous datasource with REST endpoints back'ed on ReactiveMongo. It's quite useful to :

  • Kickstart an application and test your frontend
  • Build iteratively your models from blob to static (or just go on using blobs with some Json validations)
  • Expose your existing models as REST sources in a very few lines

The concept is explained more precisely in these articles:

Read these articles and look at code in app/Application.scala and conf/routes, it's quite explicit and provides everything to start.

To test it:

  1. Run a Mongo Server on your local computer
  2. Just run the application by launching classic sbt

Play-Autosource concept has been implemented for :

Maybe soon Activator's template for those Autosources...

Autosource Standard Routes

Get / Find / Stream

  • GET /persons?… -> Find by query
  • GET /persons/ID -> Find by ID
  • GET /persons/stream -> Find by query & stream result by page

Insert / Batch / Find

  • POST /persons + BODY -> Insert
  • POST /persons/find + BODY -> find by query (when query is too complex to be in a GET)
  • POST /persons/batch + BODY -> batch insert (multiple)

Update / batch

  • PUT /persons/ID + BODY -> Update by ID
  • PUT /persons/ID/partial + BODY -> Update partially by ID
  • PUT /persons/batch -> batch update (multiple)

Delete / Batch

  • DELETE /persons/ID -> delete by ID
  • DELETE /persons/batch + BODY -> batch delete (multiple)