Guest User

Untitled

a guest
Mar 24th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.52 KB | None | 0 0
  1. package quickstart.models.test
  2.  
  3. import quickstart.model._
  4. import com.mongodb.casbah.Imports._
  5.  
  6. import scalaz._
  7. import Scalaz._
  8.  
  9. object MongoFun {
  10.   trait SMongoDB {
  11.     self: MongoDB =>
  12.     type SMongoCollection = Validation[String, MongoCollection]
  13.  
  14.     override def getCollection(collection:String):SMongoCollection = try {
  15.       success((this(collection)))
  16.     } catch {
  17.       case ex => failure(ex.getMessage)
  18.     }
  19.   }
  20.  
  21.   implicit def toSMongoDB(db:MongoDB) = new MongoDB(db.underlying) with SMongoDB
  22. }
Advertisement
Add Comment
Please, Sign In to add comment