Scala mongodb驱动程序

Scala mongodb驱动程序,mongodb,scala,mongo-scala-driver,Mongodb,Scala,Mongo Scala Driver,插入工作正常。问题在于find() 对于find() 它显示错误: org.bson.BsonInvalidOperationException: readString can only be called when CurrentBSONType is STRING, not when CurrentBSONType is OBJECT_ID. 机器的数据模型为: case class Machine(_id: String, @BsonProperty(DbConstants.FI

插入工作正常。问题在于find()

对于find()

它显示错误:

org.bson.BsonInvalidOperationException: readString can only be called when CurrentBSONType is STRING, not when CurrentBSONType is OBJECT_ID.
机器的数据模型为:

case class Machine(_id: String,
    @BsonProperty(DbConstants.FIELD_SITE_ID)siteId: BsonObjectId)
以下教程来自:

数据中可能有空值,这是导致问题的原因

case class Machine(_id: String,
    @BsonProperty(DbConstants.FIELD_SITE_ID)siteId: BsonObjectId)