Scala,Casbah:MongoCollection.insert编译错误

时间:2013-03-31 09:52:38

标签: scala compiler-errors casbah

我正在尝试编写使用Casbah工具包将数据写入MongoDB的函数:

  import com.mongodb.casbah.WriteConcern
      import ...

  def saveRecord(rec: MongoDBObject) {
    mongoColl.insert(rec)
  }

我收到以下错误:

1) No implicit view available from Object => com.mongodb.casbah.Imports.DBObject.   

2) not enough arguments for method insert: (implicit dbObjView: Object => com.mongodb.casbah.Imports.DBObject, implicit concern: com.mongodb.WriteConcern, implicit encoder: com.mongodb.casbah.Imports.DBEncoder)com.mongodb.casbah.Imports.WriteResult. Unspecified value parameter dbObjView.    

怎么了?

1 个答案:

答案 0 :(得分:0)

我不确定没有完整导入,但尝试将MongoDBObject更改为com.mongodb.DBObject或添加import com.mongodb.casbah.Imports._