https://kotlinlang.org logo
Title
e

Erik Dreyer

02/27/2023, 5:46 PM
Hi all. I’d appreciate it if someone could take a look here and help me out: https://stackoverflow.com/questions/75583729/using-kproperty-with-list-of-objects
i

Ivan Pavlov

02/27/2023, 6:24 PM
Since in mongo this query would look like
{"bars.thingy": "thingy"}
, my guess in kotlin it should be mapped similar way
Foo::bars / Bar::thingy
Just checked, it is more type-safe than I supposed, it allows only nested properties, so my suggestion won't work
Then I believe the first workaround I can think of is
Foo::bars elemMatch (Bar::thingy isEqualTo "thingy")
e

Erik Dreyer

02/28/2023, 4:25 PM
Thanks Ivan. I’ll try that
That does work. @Ivan Pavlov can I tag you on stack overflow for that answer? Or would you like to post this yourself to get credit?
i

Ivan Pavlov

02/28/2023, 5:06 PM
I posted an answer on SO
e

Erik Dreyer

02/28/2023, 6:39 PM
thanks!