I'm starting a project using play 2.2.3 and play-reactivemongo 0.10.2 (which recursively use reactivemongo 0.10.0).
I've read the documentation of both reacticemongo and play-reactivemongo along with a few projet I found on github but I can't figure out how to manage mongo's id in the cleanest way.
Because I'm lazy I decided to use automatic generation of json reader and writer (as shown in https://github.com/ReactiveMongo/Play-ReactiveMongo)
package models
case class User(
age: Int,
firstName: String,
lastName: String,
feeds: List[Feed])
case class Feed(
name: String,
url: String)
object JsonFormats {
import play.api.libs.json.Json
import play.api.data._
import play.api.data.Forms._
// Generates Writes and Reads for Feed and User thanks to Json Macros
implicit val feedFormat = Json.format[Feed]
implicit val userFormat = Json.format[User]
}
And in the same document follows a nice example of how to insert and find documents in a collection. But it does not say a thing about updating.
How do you deal with "_id" when you have to update documents ?
I was asked for an example. Here is one https://github.com/manuelleduc/bookmarks/tree/stackoverflow-example-1
I have a runtime exception when I make a call to /bookmarks route.
[RuntimeException: JsError(List((/_id,List(ValidationError(error.expected.jsstring,WrappedArray()))), (/tags,List(ValidationError(error.path.missing,WrappedArray())))))]