My trial at using Shapeless with MongoDB
Currently it supports the following types as base properties for case classes.
StringIntLongDoubleBooleanorg.bson.types.ObjectIdSeq[A], whereAis any of the first sixMap[String, A], whereAis any of the first sixOption[A], whereAis any of the first sixorg.mongodb.scala.bson.collection.immutable.Documentorg.mongodb.scala.bson.BsonDocument
import io.github.shyamsalimkumar.mongodb.shapeless._
case class User(id: String, name: String, age: Int) extends BaseDBModel
val user = User("user-001", "User 01", 50)
val userDocument = user.toDocument
// Document((age,BsonInt32{value=50}), (name,BsonString{value='User 01'}), (_id,BsonString{value='user-001'}))Any is not supported so instead of using Map[String, Any] use either Document
or BsonDocument. If you use something like Map[String, Any] it will result in a
compile error looking like the following
Try implementing an implicit BsonDocumentEncoder[io.github.shyamsalimkumar.mongodb.shapeless.models.ModelD]This error basically means that something in the ModelD model is not supported