This file contains hidden or 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
trait BlPathMatchers { | |
val BSONObjectID: PathMatcher1[BSONObjectID] = | |
PathMatcher("""[\da-fA-F]""".r) flatMap { string ⇒ | |
try Some(new BSONObjectID(string)) | |
catch { case _: IllegalArgumentException ⇒ None } | |
} | |
} |
This file contains hidden or 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
import reactivemongo.bson.{BSONHandler, BSONDateTime, Macros} | |
import org.joda.time.format.ISODateTimeFormat | |
import org.joda.time.{DateTime, DateTimeZone} | |
package object myApp { | |
DateTimeZone.setDefault(DateTimeZone.UTC) | |
implicit object BSONDateTimeHandler extends BSONHandler[BSONDateTime, DateTime] { | |
val fmt = ISODateTimeFormat.dateTime() | |
def read(time: BSONDateTime) = new DateTime(time.value) |
This file contains hidden or 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
class ReactiveMongoConnection extends Module { | |
import ExecutionContext.Implicits.global | |
private val config = ConfigFactory.load() | |
implicit val context = inject[ActorSystem] | |
val driver = new MongoDriver | |
val pattern = "^mongodb:\\/\\/([\\w]*):([\\w]*)@([\\w\\.-]+):([\\d]+)\\/([\\w]+)".r | |
val envUri = Properties.envOrElse("MONGOLAB_URI", "").toString |
OlderNewer