AggregateIterable

    List dbObjects = new ArrayList<>();
    Document document=new Document();
    Document unwind =new Document();
    Document match =new Document();
    document.append("weight",2.6);
    document.put("evaluation.eva1","好0");
    match.put("$match",document);
    unwind.put("$unwind","$evaluation");
    dbObjects.add(unwind);
    dbObjects.add(match);
    AggregateIterable x =mongoTemplate.getCollection("apple").aggregate(dbObjects);
    System.out.println(x==null);
   MongoCursor it=x.iterator();
    while (it.hasNext()){
        Document document1=it.next();
        System.out.println(document1.toJson());
    }

你可能感兴趣的:(mongodb)