Closed dajor closed 5 years ago
@dajor You can set DocumentList to output like this:
def main(docs: func.DocumentList, outdoc: func.Out[func.Document]) -> str:
...snip...
newdoc1_dict = {}
newdoc1_dict["id"] = "idxxxxxxxxxxxxx1"
newdoc1_dict["name"] ="namexxxxxxxx1"
newdoc1_dict["text"] = "textxxxxxxxxxx1"
newdoc2_dict={}
newdoc2_dict["id"] = "idxxxxxxxxxxxxx2"
newdoc2_dict["name"] ="namexxxxxxxx2"
newdoc2_dict["text"] = "textxxxxxxxxxx2"
newdocs = func.DocumentList()
newdocs.append(func.Document.from_dict(newdoc1_dict))
newdocs.append(func.Document.from_dict(newdoc2_dict))
outdoc.set(newdocs)
I modified my sample code to give DocumentList as output object in this: https://github.com/yokawasa/azure-functions-python-samples/blob/master/v2functions/cosmos-trigger-cosmodb-output-binding/__init__.py
I close this but please feel free to re-open if you want
In C# it is possible to output more than one document to cosmos. Is there a way to output in python as well more than one document.
It works with one document but I found now way to pass to doc.set a array