I wish to create azure cosmos databases from Java code using the com.microsoft.azure:azure-documentdb:2.4.1. I can only find the option to set offerThroughput which is for collections created in the database.
Does anyone know how to do this?
I wish to create azure cosmos databases from Java code using the com.microsoft.azure:azure-documentdb:2.4.1. I can only find the option to set offerThroughput which is for collections created in the database.
Does anyone know how to do this?
Please use below code:
public static void main(String[] args) throws DocumentClientException {
DocumentClient client = new DocumentClient(
YOUR_COSMOS_DB_ENDPOINT,
YOUR_COSMOS_DB_MASTER_KEY,
new ConnectionPolicy(),
ConsistencyLevel.Session);
RequestOptions requestOptions = new RequestOptions();
requestOptions.setOfferThroughput(500);
Database database = new Database();
database.setId("testdb");
client.createDatabase(database,requestOptions);
}
If you want to update RU settings, you could refer to my previous case: