Use aggregation to throw exceptions in spring data MongoDB MongoDB version 3.6
Org.springframework.dao.InvalidDataAccessApiUsageException:Command execution failed: for
Spring Data MongoDB version
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>1.5.8.RELEASE</version>
</dependency>
Upgrading Mongodb-driver to 3.6 does not solve the problem
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<exclusions>
<exclusion>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.6.0-beta2</version>
</dependency>
Downgrade the MongoDB version to 3.4
It's a yum source.
MongoDB 3.4
3.4
1. vi /etc/yum.repos.d/mongodb-3.4.repo
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/ gpgcheck=0 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc
MongoDB 3.6
2. vim /etc/yum.repos.d/mongodb-org-3.4.repo
3. [mongodb-org-3.4]
4. name=MongoDB Repository
5. baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
6. gpgcheck=0
7. enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
Although the warehouse is written in 3.4, it will actually download the new version of 3.6
Dependency resolution
=========================================================== =========================================================== =========================================================== =========================================================== =========================================================== =====================
Package architecture version source size
=========================================================== =========================================================== =========================================================== =========================================================== =========================================================== =====================
deleting:
Mongodb-org x86_64 3.6.0-0.1.rc0.el7 @mongodb-org-3.4 0.0
Mongodb-org-mongos x86_64 3.6.0-0.1.rc0.el7 @mongodb-org-3.4 31 M
Mongodb-org-server x86_64 3.6.0-0.1.rc0.el7 @mongodb-org-3.4 56 M
Mongodb-org-shell x86_64 3.6.0-0.1.rc0.el7 @mongodb-org-3.4 31 M
Mongodb-org-tools x86_64 3.6.0-0.1.rc0.el7 @mongodb-org-3.4 152 M
Transaction summary
=========================================================== =========================================================== =========================================================== =========================================================== =========================================================== ===================
Springdata MongoDB version compatibility causes Error [the ' cursor ' option is required, except for aggregate with the explain argument