Я пытаюсь вставить документ JSon в azure cosmos db, у моего документа Json есть столбец id, существующий со строковым значением. При вставке этого JSONObject в Cosmos DB с помощью функции CreateItem выдается сообщение об ошибке, в котором говорится: «Входное содержимое недопустимо, потому что требуемые свойства -« id; »- отсутствуют». Ниже приведен код и пример загрузки JSONObject. Может ли кто-нибудь помочь?
query = "select * from <ks>.<tn>";
Statement st = new SimpleStatement(query);
ResultSet rows = session.execute(st.setFetchSize(1000));
Iterator<Row> it = rows.iterator();
while (it.hasNext()) {
if (rows.getAvailableWithoutFetching() == 100 && !rows.isFullyFetched())
rows.fetchMoreResults();
}
Row row = it.next();
JSONObject jsonObject = new JSONObject(row.getString("[json]"));
jsonObject.put("id",jsonObject.get("doc_id"));
CosmosItemRequestOptions cosmosItemRequestOptions = new
CosmosItemRequestOptions();
CosmosItemResponse<JSONObject> item = container.createItem(jsonObject, new
PartitionKey((String) jsonObject.get("doc_id")), cosmosItemRequestOptions);
}
Образец Json do c:
{
"abc": null,
"year": 1996,
"name": "",
"num": null,
"anum": null,
"st": "mo",
"did": "1398",
"de": null,
"sq": null,
"dq": "",
"d":null,
"dpp": null,
"dif": null,
"dmf": null,
"dtc": null,
"id": "1398-48",
"day": null,
"dtc": null,
"drt": null,
"nr": null,
"daf": null,
"ds": null,
"da": null,
"andrf": null
}