Skip to content

Commit c2d7fa2

Browse files
authored
Update functions-bindings-cosmosdb-v2-trigger.md
This sample code doesn't work. It's old implementation of the decorator for CosmosDBTrigger class. According to the definition of decorator in azure-functions-python-library/azure/functions/decorators /cosmosdb.py, it should be like this. https://github.com/Azure/azure-functions-python-library/blob/dev/azure/functions/decorators/cosmosdb.py
1 parent 949422a commit c2d7fa2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

articles/azure-functions/functions-bindings-cosmosdb-v2-trigger.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,12 @@ import azure.functions as func
334334
app = func.FunctionApp()
335335

336336
@app.function_name(name="CosmosDBTrigger")
337-
@app.cosmos_db_trigger(arg_name="documents",
337+
@app.cosmos_db_trigger(name="documents",
338+
connection="CONNECTION_SETTING",
338339
database_name="DB_NAME",
339-
collection_name="COLLECTION_NAME",
340-
connection_string_setting="CONNECTION_SETTING",
341-
lease_collection_name="leases", create_lease_collection_if_not_exists="true")
340+
container_name="CONTAINER_NAME",
341+
lease_container_name="leases",
342+
create_lease_container_if_not_exists="true")
342343
def test_function(documents: func.DocumentList) -> str:
343344
if documents:
344345
logging.info('Document id: %s', documents[0]['id'])

0 commit comments

Comments
 (0)