This is the assignment for Homeworks 3.2 and 3.3 of the M101J MongoDB online course translated to Scala and Play Framework.
This project uses the official MongoDB Scala driver Casbah.
The integration of Casbah into Play is done by the MongoDB Salat Plugin for the Play Framework. We don't use the ORM features of this plugin, only the connection management.
As in the original Java + Spark version of the assignment, your task is to implement the missing data access logic
in MongoBlogPostDAO
. Look for occurences of XXX
in app/models/blogPost.scala.
In MongoBlogPostDAO
, you access the MongoCollection
through the posts
private field.
You still need running mongod on your machine. The only difference is the blog's web application.
After you're done with the implmentation you need to run the application and the validation script (validate.py
) that
comes with the original version of this assignment.
The validation script expects the application to be running at localhost:8082
:
> play run 8082
Then run the validation script in a different terminal. If you implemented the required features correctly, the script will provide a validation code that you will need for the assignment's submission form.
This project uses the Cake Pattern to glue together the application - specifically the BlogController
to the DAOs.
You don't actually need to understand the whole application, although I encourage you to dig into it.
And if you look at the code, you will notice that this project does not properly separate the MVC layers. Passing MongoDB-specific objects created by the database driver (model) to templates (view) is not something you want to do in a real-world application. Fixing this design problem however, would require additional work and would introduce more differences from the original Java + Spark version.
This project is provided "as is". It has not been properly tested and there is no official support for it provided by anyone (especially not by 10gen). It is intended for M101J's students interested in Scala and it will most likely be harder to pass the course using this instead of the official Java + Spark version.
Last but not least: Do not publicly disclose solutions to the course's homeworks.