我正在尝试编写使用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.
怎么了?
答案 0 :(得分:0)
我不确定没有完整导入,但尝试将MongoDBObject
更改为com.mongodb.DBObject
或添加import com.mongodb.casbah.Imports._