Created
December 2, 2016 15:25
-
-
Save applethepeanut/ff70a7c7ded860db7e71547073c9aa63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit object AccountReader extends BSONDocumentReader[Account] { | |
override def read(bson: BSONDocument): Account = { | |
val account: Option[Account] = for { | |
id <- bson.getAs[BSONObjectID]("_id") | |
... | |
} yield new Account(id, ...) | |
account.getOrElse(boom) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment