Referring to nested documents
For the rest of this article, let's take the following example, in which the collection we're interested in is User
:
class User(
val name: String,
val country: Country,
val pets: List<Pet>,
)
class Country(
val id: String,
val code: String,
)
class Pet(
val id: String,
val name: String,
)
Referring to a non-nested field is identical with KMongo and KtMongo:
Referring to nested documents is identical with both libraries:
Referring to a list item by index uses the get
operator: