Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.bson.types.ObjectId
- import org.litote.kmongo.KMongo
- import org.litote.kmongo.findOne
- import org.litote.kmongo.getCollection
- data class ShipDetail(
- var _id: String? = null,
- var order_id: String? = null)
- fun main(args: Array<String>) {
- val client = KMongo.createClient()
- val database = client.getDatabase("test")
- val collection = database.getCollection<ShipDetail>("ship_detail")
- collection.insertOne(ShipDetail(ObjectId().toHexString(),"order"))
- val r = collection.findOne()
- println(r)
- }
Add Comment
Please, Sign In to add comment