有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

如何使用Java MongoDB驱动程序访问文档列表中的值和字段?

我正在使用MongoDB Java驱动程序,我已经花了将近一个小时研究如何处理文档列表并从中获取值,但我还没有找到任何适合我的方法

下面是我的相关代码部分,以及不同文档列表的浓缩控制台输出。如果有人能解释一下如何基本上把我的“ScoreGet”值组合成一个数组,我会非常感激的,因为我无法理解任何东西

    List<Document> englishOut = (List<Document>) englishCollection.find()
            .projection(Projections.include("scoreout")).into(
                    new ArrayList<Document>());

    List<Document> englishGot = (List<Document>) englishCollection.find()
            .projection(Projections.include("scoregot")).into(
                    new ArrayList<Document>());

    List<Document> assignType = (List<Document>) englishCollection.find()
            .projection(Projections.include("scoretype")).into(
                    new ArrayList<Document>());

[Document{{{u id=5B3EC0D3BECB309D804CE7E,scoretype=quick}, 文件{{u id=5b3ec18cbeceb309d804ce7f,scoretype=hw}

[Document{{{u id=5b3ec0d3beceb309d804ce7e,scoreout=25.0}},Document{{{u id=5b3ec18cbeceb309d804ce7f,scoreout=5.0}

[Document{{{u id=5b3ec0d3beceb309d804ce7e,scoregot=23.0}},Document{{{u id=5b3ec18cbeceb309d804ce7f,scoregot=5.0}


共 (0) 个答案