Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
how to write Mongo type query with Kotlin sealed class

I want to access Mongo DB using Kotlin with the help of Kmongo (litote.org) plugins and I only want to write Kmong Typed query. https://litote.org/kmongo/typed-queries/

My Kotlin data classes are below:

 data class Student(
  studentId:ObjectId,
  subStdClass:StudentSubClass
 )

sealed class StudentSubClass(stdClassId: ObjectId, type: ClassType) {
  data class SubMarksClass(val subClassId: ObjectId, override val envId: ObjectId)
}

So my normal Komogo query is as below:

 StudentDao.find(Student::studentId eq anyobjectId)
                 OR
 StudentDao.find(Student::subStdClass / StudentSubClass::stdClassId eq someobjectId)

in same way how can I access subClassId which present in SubClass of StdClass sealed class

I have tried below query format, but it doesn't work,

 StudentDao.find(Student::subStdClass / StudentSubClass.SubMarksClass::subClassId eq someobjectId)

so please help me on that, Thanks in advance..

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!