报错:
Exception in thread "main" com.mongodb.MongoCommandException: Command failed with error 352: 'Unsupported OP_QUERY command: create.
上图中“The client driver may require an upgrade”说明了“客户端驱动需要进行升级”,解决办法就行升级驱动:
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-legacy</artifactId>
<version>4.4.0</version>
</dependency>
扩展:
新版的artifactId和老版不一样,以下是旧版本的驱动,了解下即可:
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.2.2</version>
</dependency>