spring+springmvc
https://docs.spring.io/spring-data/mongodb/docs/2.2.6.RELEASE/reference/html/#mongo.core
框架版本(必须):
1.MongoDB 4.0.x
2.spring 5.1.1.RELEASE以上
3.spring-data-mongodb:2.1.1.RELEASE以上
4.Mongodb副本集
mongodb.properties 文件
#config for mongoDB
mongo.username=bryce
mongo.password=bryce
#mongo.host=192.168.161.128
#mongo.port=27088
mongo.replSet=10.15.55.100:27017
mongo.minConnectionsPerHost=10
mongo.threadsAllowedToBlockForConnectionMultiplier=4
mongo.connectTimeout=30000
mongo.maxWaitTime=3000
mongo.socketKeepAlive=false
mongo.socketTimeout=30000
mongo.maxConnectionIdleTime=0
mongo.maxConnectionLifeTime=0
mongo.heartbeatSocketTimeout=20000
mongo.heartbeatConnectTimeout=10000
mongo.minHeartbeatFrequency=3000
mongo.heartbeatFrequency=5000
mongo.database=testdb
mongodb.xml文件