Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
migration to new db config
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Feb 8, 2020
1 parent 2dff79f commit b818560
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/com/andromeda/araserver/pages/UpdateDB.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.andromeda.araserver.pages

import com.microsoft.azure.documentdb.*
import org.json.JSONObject
import javax.json.JsonObject
import javax.json.JsonValue

class UpdateDB {
fun main(url:String){

}
fun update(client:DocumentClient, key: String, id:String, prop:String, newVal:String){
val options = FeedOptions()
options.partitionKey = PartitionKey("user-$key")
val queryResults: FeedResponse<Document> = client.queryDocuments("/dbs/Ara-android-database/colls/Ara-android-collection", "SELECT * FROM c WHERE c.id = '$id'", options)
val doc:Document =queryResults.queryIterable.first()
val j = JSONObject()
(doc.get("document") as JSONObject).putOpt(prop, newVal)
}
}

0 comments on commit b818560

Please sign in to comment.