Guest User

Untitled

a guest
Nov 25th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. import org.bson.types.ObjectId
  2. import org.litote.kmongo.KMongo
  3. import org.litote.kmongo.findOne
  4. import org.litote.kmongo.getCollection
  5.  
  6. data class ShipDetail(
  7. var _id: String? = null,
  8. var order_id: String? = null)
  9.  
  10. fun main(args: Array<String>) {
  11. val client = KMongo.createClient()
  12. val database = client.getDatabase("test")
  13. val collection = database.getCollection<ShipDetail>("ship_detail")
  14. collection.insertOne(ShipDetail(ObjectId().toHexString(),"order"))
  15. val r = collection.findOne()
  16. println(r)
  17. }
Add Comment
Please, Sign In to add comment