8000 prettyprint the json · nickldp/docs-kotlin@b569eec · GitHub
[go: up one dir, main page]

Skip to content

Commit b569eec

Browse files
committed
prettyprint the json
1 parent 6cff67f commit b569eec

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

examples/src/test/kotlin/AggregationTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import kotlinx.coroutines.flow.toList
1010
import kotlinx.coroutines.runBlocking
1111
import org.bson.Document
1212
import org.bson.codecs.pojo.annotations.BsonId
13+
import org.bson.json.JsonWriterSettings
1314
import org.junit.jupiter.api.AfterAll
1415
import org.junit.jupiter.api.BeforeAll
1516
import org.junit.jupiter.api.Test
@@ -129,7 +130,8 @@ class AggregationTest {
129130
Aggregates.group("\$${Restaurant::stars.name}", Accumulators.sum("count", 1))
130131
)
131132
).explain(ExplainVerbosity.EXECUTION_STATS)
132-
println(explanation.toJson())
133+
// Prettyprint the output
134+
println(explanation.toJson(JsonWriterSettings.builder().indent(true).build()))
133135
// :snippet-end:
134136
val ok = explanation["ok"]
135137
assertEquals(1.0, ok)

source/examples/generated/AggregationTest.snippet.explain-aggregation.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ val explanation = collection.aggregate<Results>(
66
Aggregates.group("\$${Restaurant::stars.name}", Accumulators.sum("count", 1))
77
)
88
).explain(ExplainVerbosity.EXECUTION_STATS)
9-
println(explanation.toJson())
9+
// Prettyprint the output
10+
println(explanation.toJson(JsonWriterSettings.builder().indent(true).build()))

0 commit comments

Comments
 (0)
0