Guest User

Untitled

a guest
Dec 15th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. fun getUserBy(id):User {
  2. val document = findBy(id)
  3.  
  4. return Gson().fromJson(document.toJson(), User::class.java)
  5. }
  6.  
  7. fun findBy(id:String): Document {
  8. return mongoClient.getDatabase("db")
  9. .getCollection("user")
  10. .find(BasicDBObject("_id", id)).first()
  11. }
Add Comment
Please, Sign In to add comment