Kotlin-cosmos is a client for Azure CosmosDB 's SQL API (also called documentdb formerly). Which is an opinionated library aimed at ease of use for CRUD and find (aka. query).
- Microsoft's official Kotlin CosmosDB client is for Android
- Microsoft's official Java CosmosDB client is verbose to use
- This is an alpha version, and features are focused to CRUD and find at present.
TODO
TODO
import io.github.thunderz99.cosmos.Cosmos
data class User(val id:String, val firstName:String, val lastName:String )
fun main() {
val db = Cosmos(System.getenv("YOUR_CONNECTION_STRING")).getDatabase("Database1")
db.createIfNotExist("Collection1")
db.upsert("Collection1", data = User("id011", "Tom", "Banks"))
val users = db.find("Collection1", filter {
"id" > "id010",
"lastName" to "Banks"
}).toList<User>()
}
//TODO
//TODO
//TODO