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

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Feb 11, 2020
1 parent b710cd1 commit 9bbbb25
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/andromeda/araserver/pages/UpdateDB.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ class UpdateDB {
private fun update(client:DocumentClient, key: String, id:String, prop:String, newVal:Any){

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 ", options)
options.enableCrossPartitionQuery = true
val queryResults: FeedResponse<Document> = client.queryDocuments("/dbs/Ara-android-database/colls/Ara-android-collection", "SELECT * FROM c", options)
queryResults.queryIterable.forEach{
println(it.id)
if (it.id == id){
(it.get("document") as JSONObject).putOpt(prop, newVal)
println("got it")
client.replaceDocument(it, RequestOptions())}}
}
fun arrayUpdate(url: String, postData:String): String {
Expand Down

0 comments on commit 9bbbb25

Please sign in to comment.