How to tell DocumentDB SDK to use camelCase during linq query?

The DocumentDB LINQ provider does not pick up the JsonConvert.DefaultSettings. In general you can use the DefaultSettings to control camelCase, but for those properties you wish to use in a LINQ Where clause must have the name explicitly set using JsonProperty attribute on your DTO.

public class User
{
    public string Id { get; set; }

    [JsonProperty("userName")]
    public string UserName { get; set; }
}

Although a bit tedious and a good source for bugs, it seems to be your only option for now.


In a similar case with Cosmos DB, I was able to set all properties to Camel case for my objects at the class declaration level, as in:

[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class User
{
    public string Id { get; set; }

    public string UserName { get; set; }
}

This is how you tell NewtonSoft.Json to use Camel case for serializing.