0

假设我有一个JsValue.

val dbo = MongoDBObject("id" -> "0001", "name" -> "Kevin", "age" -> "100") 
val json: JsValue = Json.parse(dbo.toString)

我试图通过json 插入

val obj = MongoDBObject("key" -> json)
collection.insert(obj)

但是,当我从 Mongo shell 中执行时,有很多括号[]添加到该部分。jsondb.collection.findOne()

如何在 Casbah 中正确地将 JsValue 添加到 Mongo 中?

4

0 回答 0