1

We have use the below code to connect to documentdb as below

import org.springframework.data.mongodb.repository.MongoRepository
import org.springframework.data.mongodb.repository.Query
import abc.apidigitalwellnesscs.models.DBDigitalWellnessUser


interface UserRepository: MongoRepository<DBDigitalWellnessUser, String> {

   fun save(data: DBDigitalWellnessUser): DBDigitalWellnessUser
   @Query(value = "{ 'mdmid' : ?0 }")
   fun findByMdmid(mdmid: String): DBDigitalWellnessUser
}

and below is the simple config for mongodb uri

spring:
 data:
  mongodb:
   uri: ${DATABASE_URI}

I have found that this code does not limit connection base on default 100 connecton pool and found the socket timeout error, it spike up to 1600 - 1800 connection as capture screen enter image description here

Do any one know what is the problem or what I have done wrong

0 Answers0