https://kotlinlang.org logo
#kmongo
Title
# kmongo
a

Ashni Mehta

11/05/2023, 6:05 PM
Hi folks, I'm a Product Manager at MongoDB! We released the Kotlin driver a few months ago, and we'd love to hear some feedback -- if you've migrated from kmongo to the official driver, any pain points, etc. Feel free to chime in via 🧵!
c

CLOVIS

11/06/2023, 2:56 PM
For now, we haven't migrated, mostly because of the cost of rewriting all our requests from
Copy code
collection.find(
    User::gender eq "female",
    User::age eq 29,
)
to
Copy code
val filter = Filters.and(Filters.eq(User::gender.name, "female"), <http://Filters.gt|Filters.gt>(User::age.name, 29))
val results = collection.find<Results>(filter)
which is much harder to read for no obvious benefit. Would it be possible to clarify on the builder page how to create builders that use subfields? For example, if I have:
Copy code
class User(
    val name: String,
    val preferences: Set<Preference>,
)

class Preference(
    val type: String,
)
how can I write a request using the builders that adds
Preference("foo")
to the user
"test"
, if they do not already have it? (
$pushToSet
). I haven't found an example of how to do this in the documentation.
👍 1
a

Ashni Mehta

11/07/2023, 9:41 PM
appreciate the feedback! i'll pass that along to our docs team.
quick clarifying question -- we currently support $addToSet and $push and have examples around both of those. is there something specific you were hoping to see in the examples that isn't currently there?
c

CLOVIS

11/10/2023, 3:36 PM
What I'm most interested in is “how to you do operations on a field that is not in the root document”, what is written `Parent::foo / Child::bar`in KMongo. All the examples I've seen in the doc only use a root document without nested documents (or maybe I missed one?)
👍 1
a

Ashni Mehta

11/13/2023, 5:15 PM
ah, understood. i'll ask the docs team to update the example data class that we use for that Builders page (and the examples). appreciate the feedback!
🙏 1
2 Views