My query returns Iterable elements and now I want to return it to the user in JSON format but Jersey can not convert it. it says:
A message body writer for Java class org.jongo.MongoIterator, and Java type java.lang.Iterable, and MIME media type application/xml was not found
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Iterable<Complex> getISS(){
DB db = ConnectionHelper.client.getDB("testdb");
Jongo jongo = new Jongo(db);
MongoCollection complex = jongo.getCollection("COMPLEX");
Iterable<Complex> all = complex.find().as(Complex.class);
return all;
}
Do I need to convert it to List type or there is other effective way to do it?