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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -