2

I have created collections with camelcase partition keys like \locationId instead of \LocationId. Also when inserting / updating documents in cosmosdb, i have added them as camelcase using below code :

T entity = null;
var settings = new JsonSerializerSettings 
{ 
      ContractResolver = new CamelCasePropertyNamesContractResolver() 
};

var messageBody = JsonConvert.SerializeObject(entity, Formatting.Indented, settings);

using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(messageBody)))
{
      var res = Resource.LoadFrom<Document>(memoryStream);
      await _client.UpsertDocumentAsync((await _collection).SelfLink, res, option);
}

However, when retriving any document using linq condition, the result is always null. I have decorated all CosmosDB T types with [JsonProperty(PropertyName = "id")]

Am i missing something here?

RJoshi
  • 31
  • 1
  • 3

0 Answers0