MongoDB extract information and create object

0
    public void BuscarPorfecha(String fecha) {
    BOE boe = new BOE();
    List<BOE> lista = new ArrayList<BOE>();
    int i = 0;
    MongoCursor<Document> cursor = collection.find(eq("fecha", fecha)).iterator();
    while (cursor.hasNext()) {
            System.out.println(cursor.next().toJson());
        }
    }

How could I create an object from the cursor.next (). toJson () ??

    
asked by jlgf 03.02.2017 в 18:25
source

1 answer

0

You can create an object directly from cursor.next ():

    Document document = cursor.next();
    
answered by 19.02.2017 в 15:50