diff --git a/core/src/test/kotlin/com/github/inflab/spring/data/mongodb/core/aggregation/search/WildcardSearchOperatorDslTest.kt b/core/src/test/kotlin/com/github/inflab/spring/data/mongodb/core/aggregation/search/WildcardSearchOperatorDslTest.kt index c66c428c..03ec1c5e 100644 --- a/core/src/test/kotlin/com/github/inflab/spring/data/mongodb/core/aggregation/search/WildcardSearchOperatorDslTest.kt +++ b/core/src/test/kotlin/com/github/inflab/spring/data/mongodb/core/aggregation/search/WildcardSearchOperatorDslTest.kt @@ -9,7 +9,7 @@ internal class WildcardSearchOperatorDslTest : FreeSpec({ WildcardSearchOperatorDsl().apply(block) "allowAnalyzedField" - { - "should set with given value" { + "should build an option with given value" { // given val operator = wildcard { allowAnalyzedField = true @@ -32,7 +32,7 @@ internal class WildcardSearchOperatorDslTest : FreeSpec({ } "query" - { - "should set query by string" { + "should build a query by string" { // given val operator = wildcard { query("query") @@ -53,7 +53,7 @@ internal class WildcardSearchOperatorDslTest : FreeSpec({ ) } - "should set query by multiple strings" { + "should build a query by multiple strings" { // given val operator = wildcard { query("query1", "query2") @@ -79,7 +79,7 @@ internal class WildcardSearchOperatorDslTest : FreeSpec({ } "path" - { - "should set path by strings" { + "should build a path by strings" { // given val operator = wildcard { path("path1", "path2") @@ -103,7 +103,7 @@ internal class WildcardSearchOperatorDslTest : FreeSpec({ ) } - "should set path by iterable property" { + "should build a path by iterable property" { // given data class TestCollection(val path1: List) val operator = wildcard { @@ -125,7 +125,7 @@ internal class WildcardSearchOperatorDslTest : FreeSpec({ ) } - "should set path by multiple properties" { + "should build a path by multiple properties" { // given data class TestCollection(val path1: String, val path2: String) val operator = wildcard { @@ -150,7 +150,7 @@ internal class WildcardSearchOperatorDslTest : FreeSpec({ ) } - "should set path by nested property" { + "should build a path by nested property" { // given data class Child(val path: String) data class Parent(val child: Child) @@ -173,7 +173,7 @@ internal class WildcardSearchOperatorDslTest : FreeSpec({ ) } - "should set path by option block" { + "should build a path by option block" { // given data class TestCollection(val path1: String, val path2: List) val operator = wildcard { @@ -205,7 +205,7 @@ internal class WildcardSearchOperatorDslTest : FreeSpec({ } "score" - { - "should set score" { + "should build a score" { // given val operator = wildcard { score { diff --git a/example/spring-data-mongodb/src/main/kotlin/com/github/inflab/example/spring/data/mongodb/repository/WildcardSearchRepository.kt b/example/spring-data-mongodb/src/main/kotlin/com/github/inflab/example/spring/data/mongodb/repository/atlas/WildcardSearchRepository.kt similarity index 97% rename from example/spring-data-mongodb/src/main/kotlin/com/github/inflab/example/spring/data/mongodb/repository/WildcardSearchRepository.kt rename to example/spring-data-mongodb/src/main/kotlin/com/github/inflab/example/spring/data/mongodb/repository/atlas/WildcardSearchRepository.kt index 319e823d..5210da71 100644 --- a/example/spring-data-mongodb/src/main/kotlin/com/github/inflab/example/spring/data/mongodb/repository/WildcardSearchRepository.kt +++ b/example/spring-data-mongodb/src/main/kotlin/com/github/inflab/example/spring/data/mongodb/repository/atlas/WildcardSearchRepository.kt @@ -1,4 +1,4 @@ -package com.github.inflab.example.spring.data.mongodb.repository +package com.github.inflab.example.spring.data.mongodb.repository.atlas import com.github.inflab.example.spring.data.mongodb.entity.mflix.Movies import com.github.inflab.spring.data.mongodb.core.aggregation.aggregation @@ -44,6 +44,9 @@ class WildcardSearchRepository( query("*\\?") } } + + // TODO: add $limit stage + project { excludeId() +Movies::title diff --git a/example/spring-data-mongodb/src/test/kotlin/com/github/inflab/example/spring/data/mongodb/repository/WildcardSearchRepositoryTest.kt b/example/spring-data-mongodb/src/test/kotlin/com/github/inflab/example/spring/data/mongodb/repository/atlas/WildcardSearchRepositoryTest.kt similarity index 74% rename from example/spring-data-mongodb/src/test/kotlin/com/github/inflab/example/spring/data/mongodb/repository/WildcardSearchRepositoryTest.kt rename to example/spring-data-mongodb/src/test/kotlin/com/github/inflab/example/spring/data/mongodb/repository/atlas/WildcardSearchRepositoryTest.kt index 03d4d2bc..efac91bb 100644 --- a/example/spring-data-mongodb/src/test/kotlin/com/github/inflab/example/spring/data/mongodb/repository/WildcardSearchRepositoryTest.kt +++ b/example/spring-data-mongodb/src/test/kotlin/com/github/inflab/example/spring/data/mongodb/repository/atlas/WildcardSearchRepositoryTest.kt @@ -1,12 +1,9 @@ -package com.github.inflab.example.spring.data.mongodb.repository +package com.github.inflab.example.spring.data.mongodb.repository.atlas import com.github.inflab.example.spring.data.mongodb.extension.AtlasTest -import io.kotest.core.annotation.Ignored import io.kotest.core.spec.style.FreeSpec import io.kotest.matchers.shouldBe -import io.kotest.matchers.string.shouldContain -@Ignored @AtlasTest(database = "sample_mflix") internal class WildcardSearchRepositoryTest( private val wildcardSearchRepository: WildcardSearchRepository, @@ -28,6 +25,12 @@ internal class WildcardSearchRepositoryTest( val result = wildcardSearchRepository.findTitleWithQuestionMark() // then - result.mappedResults.map { it.title shouldContain "?" } + result.mappedResults.take(5).map { it.title } shouldBe listOf( + "Where Are My Children?", + "Who Killed Cock Robin?", + "What's Opera, Doc?", + "Will Success Spoil Rock Hunter?", + "Who Was That Lady?", + ) } })