问题
Cloudant Client library available in Java that will store one document at a time,
CloudantClient client = ClientBuilder.account("accounbt")
.username("username").password("password")
.disableSSLAuthentication().build();*/
Database db = client.database("databaseName", true);
db.save(jsonObject);
Is there any way to save bulk document in cloudant?
回答1:
Here is the code that can enable to upload bulk upload,
CloudantClient client = ClientBuilder.account("accounbt")
.username("username").password("password")
.disableSSLAuthentication().build();*/
Database db = client.database("databaseName", true);
List<JSONObject> arrayJson = new ArrayList<String>();
arrayJson.add(new JSONObject("{data:hello}"));
arrayJson.add(new JSONObject("{data:hello1}"));
arrayJson.add(new JSONObject("{data:hello2}"));
db.bulk(arrayJson);
来源:https://stackoverflow.com/questions/40838703/how-to-save-bulk-document-in-cloudant-using-java-or-spark-java