background preloader

Mongodb

Facebook Twitter

Writing Reactive Apps with ReactiveMongo and Play, Pt. 1. 18 Oct 2012 ReactiveMongo is a brand new Scala driver for MongoDB. More than just yet-another-async-driver, it's a reactive driver that allows you to design very scalable applications unleashing MongoDB capabilities like streaming infinite live collections and files for modern Realtime Web applications. Play 2.1 has become the main reference for writing web applications in Scala. It is even better when you use a database driver that shares the same vision and capabilities. If you’re planning to write a Play 2.1-based web application with MongoDB as a backend, then ReactiveMongo is the driver for you! This article runs you through the process of starting such a project from scratch. Summary Bootstrap We assume that you have a running instance of MongoDB installed on your machine.

Since Play is currently being refactored to integrate Scala 2.10, we will work with a snapshot. Configuring SBT In order to use ReactiveMongo and the ReactiveMongo Play Plugin, we will set up the dependencies. Model. ReactiveMongo. ReactiveMongo/Play-ReactiveMongo. Riedelcastro/frontlets. SalatWithPlay2 · novus/salat Wiki. Using Salat with Play 2.0 Disclaimer: I don't know anything about the Play framework! But I can try to help you if Salat doesn't work with Play. Play Plugin Thanks to Leon Radley for this cool Play plugin!

Leon/play-salat Sample Projects I can't thank members of the Play community enough for their help in making Salat work with Play framework. And thanks again to Aaron White for his help with Play 1.2. A simple model companion Salat provides a ModelCompanion trait to provide easy access to serialization and DAO methods from your model companion object. What do you get? What do you need to do? Create a companion object to your model object, and extend ModelCompanion[ObjectType, ID]. ModelCompanion[ObjectType, ID] defines def dao: DAO[ObjectType, ID]. DAO[ObjectType, ID] is a top-level DAO interface. It is your choice to supply the dao instance as a def, a val, or a lazy val in your model companion. Model companion example In the example below, we are using a Context provided by Salat. Usage Examples. Leon/play-salat. Bjartek/computer-database-mongo. Working with Play framework using Scala and MongoDB | Knoldus.

Working with Play framework using Scala and MongoDB Scala : Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. More… Play Framework : Play 2.0 is a high-productivity Scala web application framework that integrates the components and APIs you need for modern web application development. Play is based on a lightweight, stateless, web-friendly architecture.

MongoDB : MongoDB is a scalable, high-performance, open source NoSQL database. Adding Dependecies : Add the following dependencies in ‘Build.scala’ File in order to use MongoDB (Here we’ll be using SalatDAO). Preparing Requests (GET and POST) : Here we are taking an example of a simple GET request. You can define the requests path and the correspondent methods in “routes” file like : Here we are defining that a GET request on this URL ” /callMe” would hit the method testMethodForPlayTutorail in Tutorial Controller. Connecting to MongoDB : Connection Class. Starter for 10 - Scala, Play 2 and Mongo - Yo Briefcase! [2.0] New MongoDB module for Play 2.0. Home · novus/salat Wiki. Welcome to the Casbah documentation — Casbah (MongoDB + Scala Toolkit Documentation v2.1.5 documentation. Welcome to the Casbah Documentation.

Casbah is a Scala toolkit for MongoDB — We use the term “toolkit” rather than “driver”, as Casbah is a layer on top of the official mongo-java-driver for better integration with Scala. This is as opposed to a native implementation of the MongoDB wire protocol, which the Java driver does exceptionally well. Rather than a complete rewrite, Casbah uses implicits, and Pimp My Library code to enhance the existing Java code.

Tutorial: Using Casbah A quick tutorial to get you started using Casbah. User Guide The full guide to Casbah - covering installation, connecting, the query dsl , gridfs, and everything between. ScalaDocs The complete ScalaDocs for Casbah along with SXR cross referenced source. Changelog The recent changes to Casbah Whats new in Casbah An indepth review of new features in MongoDB and Casbah Help and support For help and support using casbah please send emails / questions to the Casbah Mailing List on Google Groups. Contributing Offline Reading.