edofic / reactive-macros

macros for serialization and deserialization of case classes into reactive mongo BSON
3 stars 1 forks source link

FormatBSON.class requires handlers, which is available with reactivemongo 0.9 #1

Open tianjianfeng opened 11 years ago

tianjianfeng commented 11 years ago

Hi,

I am using reactivemongo 0.9. Following your example in the readme, I found problems below:

  1. BSONWriter BSONReader is not available in the handler's package.
  2. bad symbolic reference. A signature in FormatBSON.class refers to term handlers in package reactivemongo.bson which is not available. It may be completely missing from the current classpath, or the version on the classpath might be incompatible with the version used when compiling FormatBSON.class.

Thanks

edofic commented 11 years ago

from readme: NOTE this is useful for ReactiveMongo 0.8, 0.9 has different API and already contains these maros

however documentation is sparse, see ReactiveMongo 0.9 scaladoc. macros are in reactivemongo.bson.Macros

edofic commented 11 years ago

first of all the userHandler should go into the companion object

case class User(firstname: String, ...)

object User {
  implicit val userHandler = Macros.handler[User]
}

NoSuchElementException: None.get is usually a symptom of a missing field. Are you sure your existing documents will pass through the userHandler?