I want to insert documents to documentDb. This is working fine when I'm not adding a custom id property before inserting the doc.
Example
foreach (dynamic doc in docs)
{
if (doc != null)
{
doc.id = Convert.ToString(doc.myCustomId); // myCustomId is an integer
var addedDoc = await dbClient.UpsertDocumentAsync(collectionUri, doc);
addedDocuments.Add(addedDoc);
}
}
When I remove doc.id => the document is added with a guid as id.
The error is the following: "Can not convert Array to String."
" bei Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value)\r\n bei Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)\r\n bei Newtonsoft.Json.Linq.JToken.ToObject[T]()\r\n bei Microsoft.Azure.Documents.JsonSerializable.GetValue[T](String propertyName)\r\n bei Microsoft.Azure.Documents.Resource.get_Id()\r\n bei Microsoft.Azure.Documents.Client.DocumentClient.ValidateResource(Resource resource)\r\n
The code is executed in a Azure Function