Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun getUserBy(id):User {
- val document = findBy(id)
- return Gson().fromJson(document.toJson(), User::class.java)
- }
- fun findBy(id:String): Document {
- return mongoClient.getDatabase("db")
- .getCollection("user")
- .find(BasicDBObject("_id", id)).first()
- }
Add Comment
Please, Sign In to add comment