I use Java in FunctionApp.
I use output binding to update documents.
I use about this code in the Function:
@FunctionName("name")
public HttpResponseMessage run(
@HttpTrigger(name = "req",
methods = {HttpMethod.POST, HttpMethod.GET},
authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
//get all session elements by the partitionKey
@CosmosDBInput(name = "databasein",
databaseName = "dbname",
collectionName = "collectionname",
sqlQuery = "select * from c where c.sessionID ... ", //WORKING !!!
connectionStringSetting = "ConnectionStringSetting")
Object[] inputItems,
@CosmosDBOutput(name = "databaseout",
databaseName = "dbnabe",
collectionName = "collectionname",//sessions
connectionStringSetting = "ConnectionStringSetting")
OutputBinding<String> outputItem, //outputItem holds reference to the BingoSessions container
final ExecutionContext context)
{
. . .
and then I use
outputItem.setValue(documentString);
to create or update document.
}
It is partially working.
I DON'T GET ANY FEEDBACK (error, exception or even log), to know whether operation succedded or failed.
Only when I inspect the cosmosdb container, I can see if it was success or not.
When it fails, I have no idea why.