this appears to be a newbie question, I am trying to build a prototype of a CRUD reactive Mongo App using JSON Restful Webservices, I got the read, create and find thing done now I am struggeling with the update: Here is my code
object MYTest extends Controller with MongoController {
def collection: JSONCollection = db.collection[JSONCollection]("mytest")
...
def editTest = Action.async(parse.json) { request =>
request.body.validate[Test].map { test =>
collection.update(test._id, test).map { lastError =>
Ok(Json.obj("status" -> "OK"))
}
}.getOrElse(Future.successful(BadRequest("invalid json")))
}
I have a valid JSON request using CURL or Postman :
{"_id":{"$oid":"54b51834d2856ce6006723be"},"title": "Test-33388","uri": "http://test-2","author": "tester-2","overallRating": 5,"summary": "very well done","testBody": "lorem ipsum","createDate": "13/01/2015 14:05:56","modifyDate": "13/01/2015 14:05:56"}
but I get an error
</style>
</head>
<body id="play-error-page">
<h1>Execution exception</h1>
<p id="detail" class="pre">[LastError: DatabaseException['unknown top level operator: $oid' (code = 2)]]</p>
</body>
</html>
have no clue what I am doing wrong, can you help