Closed k-arabadzhiev closed 2 years ago
Use toList() as specified here: https://litote.org/kmongo/extensions-overview/#find
Then you can print the list ;)
HTH
This will print the result of the query as a list. It works as expected, however I'm trying to print the json version of the query as shown here https://litote.org/kmongo/typed-queries/#debugging-typed-queries
Ok, then you can write something like:
val q = and(
Roommate::id ne ObjectId(id),
Roommate::age gte ageMin,
Roommate::age lte ageMax,
Roommate::hasRoom ne hasRoom,
Roommate::budget gte budget - 50,
Roommate::budget lte budget + 50,
Roommate::city / City::name eq city,
Roommate::gender `in` searchFor,
Roommate::interestedIn contains gender
)
println(q.json)
val query = users.find(q).skip(skip = (page - 1) * limit).limit(limit).partial(true)
HTH
That works, thanks! Sorry for opening an issue for such a minor thing, I found about the google group later, I guess it would've been better to ask there.
Probably I'm using it wrong, I'm new to both mongo and kmongo. I'm trying to debug my query:
However, the print line will throw the exception. Otherwise it works perfectly fine.