I had something like this:

```scala
col.findOne(MongoDBObject(keyName -> key)) match {
  case None => None // key not found
  case Some(object) => object.getAs[V](valueName) match
    case None => {
    // We cannot just throw exception here, since "value" could be bound to null, e.g.: {"key": 1, "value": null}, we probably should return None here
      if (object.get(valueName) == None) None // Now, we are sure it is None
      else throw new Exception("Very bad")
    }
    case Some(value) => {
      if (manifest[V].isInstance(value)) Some(value)
      else throw new Exception("very bad again")
    }
  }
}
```

Note, I have not yet test it. Actually, have not had time to work on this since last Thur. Sorry.