Is there any option in Azure Data Factory to know the list of collections available in a particular database in Azure cosmos account?
Want to execute the particular activity - which returns list of collections in a cosmos db, every time when the Azure Data Factory pipeline get executed.
Exact requirement: Want to do copy data from all the collections from cosmos db but the list of collections in the cosmos db may vary as the time progress. If any new collection has been added to the cosmos db, dynamically that new collection needs to be considered as part of the copy activity without any external intervention.
While using Azure function activity in Azure Data factory to query the list of cosmos collection, it returns output like the below,
{
"Response": "[{\"source\":
{\"collectionName\":\"model1\"},\"destination\":
{\"fileName\":\"model1.txt\"}},{\"source\":
{\"collectionName\":\"model2\"},\"destination\":
{\"fileName\":\"model2.txt\"}}]"
}
Expected output
{
"Response": [
{
source:{collectionName:model1},
destination: {fileName:model1.txt}
},
{
source:{collectionName:model2},
destination:{fileName:model2.txt}}]
}
]
}
why Azure function activity returns array object as string?
p.s: when I run azure function separately from V22017 or azure portal it returns array object as array
I am not sure if a direct way exists but for a workaround you can
Edit- Adding discussion in comments to the answer