playframework - find a single document with play+reactivemongo -
function receives author object in request
def login = action.async (parse.json) { request => request.body.validate[author].map { author => val query = json.obj("username" -> "222") val obj = collection.find(query).one[author] obj.map { author => ok("welcome").withsession ( "username" -> "ok") } }.getorelse(future.successful(badrequest("invalid json"))) }
always results in bad request, hard coded username. what's wrong here?
changed login post. seems working now.
post /author/login @controllers.authors.login
Comments
Post a Comment