Mongodb Spring Data Mongo嵌入式测试失败,错误为;无法识别的管道阶段名称:'$graphLookup'&引用;

Mongodb Spring Data Mongo嵌入式测试失败,错误为;无法识别的管道阶段名称:'$graphLookup'&引用;,mongodb,spring-data,spring-data-mongodb,Mongodb,Spring Data,Spring Data Mongodb,我使用Spring数据和嵌入式Mongo进行的测试失败,出现“无法识别的管道阶段名称:'$graphLookup'”,这表明MongoDB的版本

我使用Spring数据和嵌入式Mongo进行的测试失败,出现“无法识别的管道阶段名称:'$graphLookup'”,这表明MongoDB的版本<3.4,但是我在设置测试时指定了v3.6,我可以从日志中看到,featureCompatibility设置正确,Mongo db驱动程序在版本3.6.4上看起来正常。当我在MongoDB的独立3.6实例上运行代码(而不是测试)时,它会按预期工作-只有使用嵌入式Flappodle mongo的测试失败。有什么建议吗

--马文原木--

--测试设置--

--存储库代码--

@覆盖
公共列表findAncestors(字符串id)
{
TypeDaggeration agg=Aggregation.newAggregation(Team.class,
匹配(标准,其中“id”)为(id)),
聚合。graphLookup(“团队”)
.startWith(“id”)
.connectFrom(“父ID”)
.连接到(“id”)
.作为(“祖先”);
AggregationResults=mongoTemplate.aggregate(agg,Team.class);
List teams=result.getMappedResults();
返回队;
}
--mvn依赖关系:树--

[INFO]正在扫描项目。。。
[信息]
[信息]------------------------------------<团队:网络>------------------------------
[信息]正在构建web 0.0.1-SNAPSHOT
[信息]------------------------------------[jar]---------------------------------
[信息]
[信息]---maven依赖插件:3.0.2:tree(默认cli)@web---
[信息]团队:web:jar:0.0.1-SNAPSHOT
[INFO]+-org.springframework.boot:springbootstarterweb:jar:2.0.8.RELEASE:compile
[INFO]|+-org.springframework.boot:spring启动程序:jar:2.0.8.RELEASE:compile
[INFO]| |+-org.springframework.boot:springbootstarter日志记录:jar:2.0.8.RELEASE:compile
[INFO]| |+-ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO]| | | \-ch.qos.logback:logback核心:jar:1.2.3:compile
[信息]|| \-org.slf4j:jul-to-slf4j:jar:1.7.25:编译
[INFO]| |+-javax.annotation:javax.annotation api:jar:1.3.2:compile
[信息]| | \-org.yaml:snakeyaml:jar:1.19:runtime
[INFO]|+-org.springframework.boot:springbootstarter json:jar:2.0.8.RELEASE:compile
[INFO]| |+-com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
[INFO]| | | \-com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
[INFO]| |+-com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.8:compile
[INFO]| |+-com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.8:compile
[INFO]| | \-com.fasterxml.jackson.module:jackson模块参数名称:jar:2.9.8:compile
[INFO]|+-org.springframework.boot:springbootstarter tomcat:jar:2.0.8.RELEASE:compile
[INFO]| |+-org.apache.tomcat.embed:tomcat嵌入核心:jar:8.5.37:compile
[INFO]| |+-org.apache.tomcat.embed:tomcat嵌入el:jar:8.5.37:compile
[INFO]| | \-org.apache.tomcat.embed:tomcat嵌入websocket:jar:8.5.37:compile
[INFO]|+-org.hibernate.validator:hibernate validator:jar:6.0.14.Final:compile
[INFO]| |+-javax.validation:validation-api:jar:2.0.1.Final:compile
[信息]| |+-org.jboss.logging:jboss logging:jar:3.3.2.Final:compile
[INFO]| | \-com.fasterxml:classmate:jar:1.3.4:compile
[信息]|+-org.springframework:springweb:jar:5.0.12.发布:编译
[INFO]| | \-org.springframework:springbeans:jar:5.0.12.RELEASE:compile
[INFO]\-org.springframework:springwebmvc:jar:5.0.12.发布:编译
[信息]|+-org.springframework:springaop:jar:5.0.12.发布:编译
[INFO]\-org.springframework:spring表达式:jar:5.0.12.RELEASE:compile
[INFO]+-org.springframework.boot:springbootstarter邮件:jar:2.0.8.RELEASE:compile
[INFO]|+-org.springframework:spring上下文:jar:5.0.12.发布:编译
[INFO]|+-org.springframework:spring上下文支持:jar:5.0.12.RELEASE:compile
[INFO]\-com.sun.mail:javax.mail:jar:1.6.2:compile
[INFO]\-javax.activation:activation:jar:1.1:compile
[INFO]+-org.springframework.boot:springbootstarter测试:jar:2.0.8.RELEASE:test
[INFO]|+-org.springframework.boot:spring启动测试:jar:2.0.8.发布:测试
[INFO]|+-org.springframework.boot:spring启动测试自动配置:jar:2.0.8.RELEASE:test
[INFO]|+-junit:junit:jar:4.12:test
[INFO]|+-org.assertj:assertj核心:jar:3.9.1:test
[信息]|+-org.mockito:mockito核心:jar:2.15.0:test
[INFO]| |+-net.bytebuddy:byte buddy:jar:1.7.11:test
[INFO]| |+-net.bytebuddy:byte好友代理:jar:1.7.11:test
[信息]| | \-org.objeness:objeness:jar:2.6:test
[信息]|+-org.hamcrest:hamcrest核心:jar:1.3:test
[INFO]|+-org.hamcrest:hamcrest库:jar:1.3:test
[信息]|+-org.skyshrayer:jsonassert:jar:1.5.0:test
[INFO]|| \-com.vaadin.external.google:android json:jar:0.0.20131108.vaadin1:test
[信息]|+-org.springframework:spring核心:jar:5.0.12.发布:编译
[信息]|| \-org.springframework:spring jcl:jar:5.0.12.发布:编译
[信息]|+-org.springframework:spring测试:jar:5.0.12.发布:测试
[INFO]\-org.xmlunit:xmlunit核心:jar:2.5.1:test
[INFO]+-com.jayway.jsonpath:json路径:jar:2.4.0:test
[INFO]|+-net.minidev:json smart:jar:2.3:test
[INFO]| | \-net.minidev:accessors智能:jar:1.2:test
[信息]| | \-org.ow2.asm:asm:jar:5.0.4:test
[INFO]\-org.slf4j:slf4j api:jar:1.7.25:编译
[INFO]+-org.springframework.boot:springbootstarter数据mongodb:jar:2.0.8.RELEASE:compile
[INFO]|+-org.mongodb:mongodb驱动程序:jar:3.6.4:compile
[信息]| |+-org.mongodb:bson:jar:3.6.4:编译
[INFO]|| \-org.mongodb:mongodb驱动核心:jar:3.6.4:compile
[INFO]\-org.springframework.data:spring数据mongodb:jar:2.0.13.RELEASE:compile
[INFO]|+-org.springframework:springtx:jar:5.0.12.发布:编译
[INFO]\-org.springframework.data:spring数据共享:jar:2.0.13.RELEASE:compile
[INFO]+-org.springframework.boot:springboot-
[mongod output] 2019-03-10T17:54:01.339+0000 I CONTROL  [initandlisten] db version v3.6.5
[mongod output] 2019-03-10T17:54:01.339+0000 I CONTROL  [initandlisten] git version: a20ecd3e3a174162052ff99913bc2ca9a839d618
[mongod output] 2019-03-10T17:54:01.339+0000 I CONTROL  [initandlisten] allocator: tcmalloc
[mongod output] 2019-03-10T17:54:01.339+0000 I CONTROL  [initandlisten] modules: none
[mongod output] 2019-03-10T17:54:01.339+0000 I CONTROL  [initandlisten] build environment:
[mongod output] 2019-03-10T17:54:01.339+0000 I CONTROL  [initandlisten]     distarch: x86_64
[mongod output] 2019-03-10T17:54:01.339+0000 I CONTROL  [initandlisten]     target_arch: x86_64
[mongod output] 2019-03-10T17:54:01.339+0000 I CONTROL  [initandlisten] options: { net: { bindIp: "127.0.0.1", port: 27018 }, security: { authorization: "disabled" }, storage: { dbPath: "/tmp/embedmongo-db-1cde0ab0-bb3d-4256-8e4c-19401c64337d", journal: { enabled: false }, mmapv1: { preallocDataFiles: false, smallFiles: true }, syncPeriodSecs: 0.0 } }
[mongod output] 2019-03-10T17:54:01.339+0000 I STORAGE  [initandlisten] 
[mongod output] 2019-03-10T17:54:02.044+0000 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 3.6
rg.springframework.data.mongodb.UncategorizedMongoDbException: Command failed with error 16436: 'Unrecognized pipeline stage name: '$graphLookup'' on server localhost:43425. The full response is { "ok" : 0.0, "errmsg" : "Unrecognized pipeline stage name: '$graphLookup'", "code" : 16436 }; nested exception is com.mongodb.MongoCommandException: Command failed with error 16436: 'Unrecognized pipeline stage name: '$graphLookup'' on server localhost:43425. The full response is { "ok" : 0.0, "errmsg" : "Unrecognized pipeline stage name: '$graphLookup'", "code" : 16436 }
        at team.teamservice.web.team.TeamRepositoryTest.findAncestors(TeamRepositoryTest.java:121)
Caused by: com.mongodb.MongoCommandException: Command failed with error 16436: 'Unrecognized pipeline stage name: '$graphLookup'' on server localhost:43425. The full response is { "ok" : 0.0, "errmsg" : "Unrecognized pipeline stage name: '$graphLookup'", "code" : 16436 }
        at team.teamservice.web.team.TeamRepositoryTest.findAncestors(TeamRepositoryTest.java:121)
  @Before
    public void setUp() throws IOException
        {

        String ip = "localhost";
        int port = 27018;

        IMongodConfig mongodConfig = new MongodConfigBuilder().version(Version.Main.V3_6)
                .net(new Net(ip, port, Network.localhostIsIPv6()))
                .build();

        MongodStarter starter = MongodStarter.getDefaultInstance();
        mongodExecutable = starter.prepare(mongodConfig);
        mongodExecutable.start();
}
@Override
public List<Team> findAncestors(String id)
    {

    TypedAggregation<Team> agg = Aggregation.newAggregation(Team.class,
            match(Criteria.where("id").is(id)),
            Aggregation.graphLookup("team")
                    .startWith("id")
                    .connectFrom("parentId")
                    .connectTo("id")
                    .as("ancestors"));

    AggregationResults<Team> result = mongoTemplate.aggregate(agg, Team.class);

    List<Team> teams = result.getMappedResults();

    return teams;
    }
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------< team:web >------------------------------
[INFO] Building web 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.0.2:tree (default-cli) @ web ---
[INFO] team:web:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.0.8.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.0.8.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.0.8.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.19:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.0.8.RELEASE:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.8:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.8:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.8:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.0.8.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.37:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.37:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.37:compile
[INFO] |  +- org.hibernate.validator:hibernate-validator:jar:6.0.14.Final:compile
[INFO] |  |  +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] |  |  \- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] |  +- org.springframework:spring-web:jar:5.0.12.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.0.12.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.0.12.RELEASE:compile
[INFO] |     +- org.springframework:spring-aop:jar:5.0.12.RELEASE:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.0.12.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:2.0.8.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:5.0.12.RELEASE:compile
[INFO] |  +- org.springframework:spring-context-support:jar:5.0.12.RELEASE:compile
[INFO] |  \- com.sun.mail:javax.mail:jar:1.6.2:compile
[INFO] |     \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.0.8.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.0.8.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.0.8.RELEASE:test
[INFO] |  +- junit:junit:jar:4.12:test
[INFO] |  +- org.assertj:assertj-core:jar:3.9.1:test
[INFO] |  +- org.mockito:mockito-core:jar:2.15.0:test
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.7.11:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.7.11:test
[INFO] |  |  \- org.objenesis:objenesis:jar:2.6:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-core:jar:5.0.12.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.0.12.RELEASE:compile
[INFO] |  +- org.springframework:spring-test:jar:5.0.12.RELEASE:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.5.1:test
[INFO] +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] |  +- net.minidev:json-smart:jar:2.3:test
[INFO] |  |  \- net.minidev:accessors-smart:jar:1.2:test
[INFO] |  |     \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:2.0.8.RELEASE:compile
[INFO] |  +- org.mongodb:mongodb-driver:jar:3.6.4:compile
[INFO] |  |  +- org.mongodb:bson:jar:3.6.4:compile
[INFO] |  |  \- org.mongodb:mongodb-driver-core:jar:3.6.4:compile
[INFO] |  \- org.springframework.data:spring-data-mongodb:jar:2.0.13.RELEASE:compile
[INFO] |     +- org.springframework:spring-tx:jar:5.0.12.RELEASE:compile
[INFO] |     \- org.springframework.data:spring-data-commons:jar:2.0.13.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-rest:jar:2.0.8.RELEASE:compile
[INFO] |  \- org.springframework.data:spring-data-rest-webmvc:jar:3.0.13.RELEASE:compile
[INFO] |     +- org.springframework.data:spring-data-rest-core:jar:3.0.13.RELEASE:compile
[INFO] |     |  +- org.springframework.hateoas:spring-hateoas:jar:0.25.0.RELEASE:compile
[INFO] |     |  +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO] |     |  \- org.atteo:evo-inflector:jar:1.2.2:compile
[INFO] |     \- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:2.0.8.RELEASE:compile
[INFO] |  +- org.thymeleaf:thymeleaf-spring5:jar:3.0.11.RELEASE:compile
[INFO] |  \- org.thymeleaf.extras:thymeleaf-extras-java8time:jar:3.0.2.RELEASE:compile
[INFO] +- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:2.3.0:compile
[INFO] |  +- nz.net.ultraq.thymeleaf:thymeleaf-expression-processor:jar:1.1.3:compile
[INFO] |  +- org.codehaus.groovy:groovy:jar:2.4.16:compile
[INFO] |  \- org.thymeleaf:thymeleaf:jar:3.0.11.RELEASE:compile
[INFO] |     +- ognl:ognl:jar:3.1.12:compile
[INFO] |     |  \- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] |     +- org.attoparser:attoparser:jar:2.0.5.RELEASE:compile
[INFO] |     \- org.unbescape:unbescape:jar:1.1.6.RELEASE:compile
[INFO] +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.10.0:compile
[INFO] |  \- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.0.8.RELEASE:compile (optional)
[INFO] |  +- org.springframework.boot:spring-boot:jar:2.0.8.RELEASE:compile
[INFO] |  \- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.8.RELEASE:compile
[INFO] +- com.google.visualization:visualization-datasource:jar:1.1.1:compile
[INFO] |  +- commons-lang:commons-lang:jar:2.4:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  +- com.google.guava:guava:jar:r07:compile
[INFO] |  +- com.ibm.icu:icu4j:jar:4.0.1:compile
[INFO] |  \- net.sf.opencsv:opencsv:jar:1.8:compile
[INFO] \- de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:2.2.0:test
[INFO]    \- de.flapdoodle.embed:de.flapdoodle.embed.process:jar:2.1.2:test
[INFO]       +- org.apache.commons:commons-lang3:jar:3.7:test
[INFO]       +- net.java.dev.jna:jna:jar:4.5.2:test
[INFO]       +- net.java.dev.jna:jna-platform:jar:4.5.2:test
[INFO]       \- org.apache.commons:commons-compress:jar:1.18:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.749 s
[INFO] Finished at: 2019-03-10T18:04:13Z
[INFO] ------------------------------------------------------------------------
spring.mongodb.embedded.version=3.6.4
spring.mongodb.embedded.features=no_http_interface_arg,only_with_ssl