Hey everyone, I want to implement User search feat...
# ktor
h
Hey everyone, I want to implement User search feature like in Instagram, suppose u type "har" and want my data base should return list of users that name matches to "har" (har , harry , haram ,Hari ) i found this on stack overflow but I'm using ktor or mongdb and I don't know how to do that , help???
lol just posted here for help and find my solution
Copy code
override suspend fun findUserByName(userName: String): List<UserData> {

    val userNameRegexQuery = Document("userName", Document("\$regex", userName).append("\$options", "i"))

    val matchingUsers = userCollection.find(userNameRegexQuery).toList()

    return matchingUsers
}