Spring Data MongoRepository介于之间,用于int值
有一个类,例如(这是Spring Data MongoRepository介于之间,用于int值,spring,mongodb,spring-data-jpa,spring-data,spring-mongo,Spring,Mongodb,Spring Data Jpa,Spring Data,Spring Mongo,有一个类,例如(这是kotlin,但代码很容易理解): @存储库 接口分数存储:MongoRepository{ 有趣的CountAllByCoreisBetween(最小值:整数,最大值:整数):整数 } @文件 数据类分数( @Id变量分数:Int, ) 两者之间的关系是包容的还是排斥的?也就是说,如果我的分数是1-10,我打电话: countAllByScoreIsBetween(3,6)我会得到4还是2?或者可能是其他东西-底部是包含的,顶部是独占的?测试(使用testcontaine
kotlin
,但代码很容易理解):
@存储库
接口分数存储:MongoRepository{
有趣的CountAllByCoreisBetween(最小值:整数,最大值:整数):整数
}
@文件
数据类分数(
@Id变量分数:Int,
)
两者之间的关系是包容的还是排斥的?也就是说,如果我的分数是1-10,我打电话:
countAllByScoreIsBetween(3,6)
我会得到4还是2?或者可能是其他东西-底部是包含的,顶部是独占的?测试(使用testcontainers
)显示:
@Autowired
lateinit var scoresRepository: ScoresRepository
@Test
fun test() {
for (i in 1..10) {
scoresRepository.save(Score(score = i))
}
val count = scoresRepository.countAllByScoreIsBetween(3, 6)
assertThat(count).isEqualTo(2)
}
据我所知,这两个参数都不包括在内。也就是说,Between
表示值之间的所有内容,不包括值本身。测试(使用testcontainers
)显示:
@Autowired
lateinit var scoresRepository: ScoresRepository
@Test
fun test() {
for (i in 1..10) {
scoresRepository.save(Score(score = i))
}
val count = scoresRepository.countAllByScoreIsBetween(3, 6)
assertThat(count).isEqualTo(2)
}
据我所知,这两个参数都不包括在内。也就是说,Between
表示值之间的所有内容,不包括值本身