[英]With Scala Salat (using mongodb casbah), how to store and load binary data?
I have a product case class defined in the way Salat expects. 我有一个以Salat期望的方式定义的产品案例类。
case class Product(@Key("product_id") productId: String,
@Key("png_image_binary") pngImageBinary: ???)
How can I add pngImageBinary so I can store this as a binary object? 如何添加pngImageBinary,以便将其存储为二进制对象?
For binary data you can use Array[Byte]
. 对于二进制数据,可以使用
Array[Byte]
。 It's equivalent of java byte[]
, which maps to Binary
BSON type. 它等效于java
byte[]
,它映射到Binary
BSON类型。 Check java types and BSON types from mongodb documentation. 从mongodb文档中检查Java类型和BSON类型 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.