I am using http://mongodb.github.io/mongo-scala-driver/
I am defining codec for one CC.
lazy val userInfoCodec: Codec[UserInfo] = new Codec[UserInfo] {
override def encode(writer: BsonWriter, value: UserInfo, encoderContext: EncoderContext): Unit = ???
override def decode(reader: BsonReader, decoderContext: DecoderContext): UserInfo = ???
}
Inside I am doing encryption, so fields instead of being Strings are Array[Byte]. Do you know how to use BsonWriter to write bytes array there ? I saw some stuff like writeStartArray, but I dont get how to use it.
Thanks for help!
Array, but instead you may give a look to theBsonBinarytype which takes abyte[]as its data argument. (theBsonWriterAPI exposes a method for writingBinaryData). - Other option would be to encode thebyte[]as a Base64Stringafter doing the encryption.