Skip to content

Instantly share code, notes, and snippets.

@elyphas
Created May 1, 2021 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elyphas/b3a71bc5cdd188d80885be4dea6a0419 to your computer and use it in GitHub Desktop.
Save elyphas/b3a71bc5cdd188d80885be4dea6a0419 to your computer and use it in GitHub Desktop.
case class Recipe (
fiscal_period: Int,
folio: String,
date: java.util.Date,
id_area: Option[String],
area: Option[String],
servicio: Option[String],
id_patient: Option[String],
) extends Document[Recipe]
object Recipe extends DocumentModel[Recipe] {
override def indexes: List[Index] = Nil
override val collectionName: String = "tblrecipe"
override val serialization: Serialization[Recipe] = Serialization.auto[Recipe]
}
def insert(item: Recipe) = {
lazy val collection = dbExample.collection("tblrecipe")
for {
_ <- db.init()
res <- collection.document.insertOne(item)
} yield {
println("DocumentInsert")
println(res)
((item, Found())).asRight[String]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment