subset icon indicating copy to clipboard operation
subset copied to clipboard

Tuple2 Reader

Open peter-empen opened this issue 12 years ago • 0 comments

It seems that tuple2Getter does not work correctly:

  val coll = db.getCollection("Tuple2Test")
  val anyDoc = new BasicDBObject 
  coll.remove(anyDoc)

  val tuple = (1,"a")
  val tupleField = "tuple".fieldOf[(Int,String)]
  coll.insert(tupleField(tuple))

  val tupleBack = coll.findOne(anyDoc)
  println(tupleBack) // ok
  tupleBack match {
    case tupleField(x) => println(x) // failure
  }   

with the failure: scala.MatchError: [ 1 , "a"](of class com.mongodb.BasicDBList). To fix it you'll possibly need to add/replace pattern matching against BasicBSONList but I'm not sure how.

Thanks Peter

peter-empen avatar Jun 05 '13 08:06 peter-empen