0

I'm using the Play Framework in conjunction with MongoDB. The View below has a loop that cycles through my collection and displays all documents, however, is there anyway to access specific fields only within the DBObject, or to totally eradicate the field names for formatting purposes? The output is currently along the lines of :

{ "_id" : { "$oid" : "548f61d97ff5d9996cf90c44"} , "reference" : "123" , "job_type" : 6months, "job_title" : "developer" , "company" : "Oracle"}

Controller:

public static Result find() {
List<DBObject> results = MongoController.find(MongoController.getLocalConnection("test"), "jobs");
if (results == null) { 
    redirect("/");
}

return ok(find_job.render(results));
}

I access the list in the view:

@(results : List[com.mongodb.DBObject])
@main("Job Listings") {

<table>
@for(result <- results) {
<tr>
    <td>@result.???</td>
</tr>
}
</table>
}
Alexander Vogt
  • 17,879
  • 13
  • 52
  • 68
drizzy
  • 139
  • 2
  • 15

0 Answers0