Skip to content

Commit e7ce79d

Browse files
committed
WIP
1 parent aaef8f3 commit e7ce79d

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

examples/src/test/kotlin/AggregatesBuilderTest.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,10 @@ class AggregatesBuilderTest {
957957
*/
958958
@Ignore
959959
fun atlasSearchOperatorTest() = runBlocking {
960+
960961
// :snippet-start: atlas-search-pipeline
962+
data class Results(val title: String, val year: Int, val genres: List<String>)
963+
961964
val searchStage = Aggregates.search(
962965
SearchOperator.compound()
963966
.filter(
@@ -971,10 +974,10 @@ class AggregatesBuilderTest {
971974
)
972975

973976
val projectStage = Aggregates.project(
974-
Projections.include("title", "year", "genres", "cast"))
977+
Projections.include(Movie::title.name, Movie::year.name, Movie::genres.name))
975978

976979
val pipeline = listOf(searchStage, projectStage)
977-
val resultsFlow = ftsCollection.aggregate(pipeline)
980+
val resultsFlow = ftsCollection.aggregate<Results>(pipeline)
978981

979982
resultsFlow.collect { println(it) }
980983
// :snippet-end:

source/examples/generated/AggregatesBuilderTest.snippet.atlas-search-pipeline.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
data class Results(val title: String, val year: Int, val genres: List<String>)
2+
13
val searchStage = Aggregates.search(
24
SearchOperator.compound()
35
.filter(
@@ -11,9 +13,9 @@ val searchStage = Aggregates.search(
1113
)
1214

1315
val projectStage = Aggregates.project(
14-
Projections.include("title", "year", "genres", "cast"))
16+
Projections.include(Movie::title.name, Movie::year.name, Movie::genres.name))
1517

1618
val pipeline = listOf(searchStage, projectStage)
17-
val resultsFlow = ftsCollection.aggregate(pipeline)
19+
val resultsFlow = ftsCollection.aggregate<Results>(pipeline)
1820

1921
resultsFlow.collect { println(it) }

source/fundamentals/builders/aggregates.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,8 @@ Search Operator Methods
909909
:language: console
910910
:visible: false
911911

912-
Document{{_id=573a1397f29313caabce734c, genres=[Comedy, Romance], cast=[George Hamilton, Susan Saint James, Richard Benjamin, Dick Shawn], title=Love at First Bite, year=1979}}
913-
Document{{_id=573a1399f29313caabcee81e, genres=[Comedy, Drama], cast=[Warren Beatty, Annette Bening, Katharine Hepburn, Garry Shandling], title=Love Affair, year=1994}}
912+
Results(title=Love at First Bite, year=1979, genres=[Comedy, Romance])
913+
Results(title=Love Affair, year=1994, genres=[Comedy, Drama])
914914

915915
Atlas Search Metadata
916916
---------------------

0 commit comments

Comments
 (0)