I am trying to integrate Azure Stream Analytics with DocumentDB and use it as a output sink. Problem is, that there are no documents created in DocDB when the processing job is running. I tried to test my query and I have even tried to mirror the output to storage account. There is json file being created in the storage containing all the values, but DocDB stays empty.
Here is my query:
WITH Res1 AS ( SELECT id,
concat(
cast( datepart(yyyy,timestamp) as nvarchar(max)),
'-',
cast( datepart(mm,timestamp) as nvarchar(max)),
'-',
cast( datepart(dd,timestamp) as nvarchar(max))) date, temp, humidity, distance, timestamp
FROM
iothub Timestamp By timestamp)
Select * into docdboutput FROM Res1
Select * into test FROM Res1
I did set the documentDB output correctly to existing collection. I also tried to provide and not to provide document id parameter and neither of the options was working. I have used date field as a partition key when creating DocDB database and collection.
I did try also manual document upload. I have copied line from the created json file in storage account. I created separate json file containing this one record and uploaded it manually to DocumentDB collection via portal. It succeeded. Here is example of one line that was output to storage file:
{"id":"8ace6228-a2e1-434d-a5f3-c2c2f15da309","date":"2017-2-10","temp":21.0,"humidity":20.0,"distance":0,"timestamp":"2017-02-10T20:47:54.3716407Z"}
Please can anyone advice me, if there is some problem with my query, or navigate me how can I investigate and diagnose further.