Search code examples
azure-cosmosdb

Cosmos DB naming conventions


I have been looking through different samples and posts, and I cant find any recommended naming conventions. When I look into a document I can see the standard properties (id, ts ..) are lower case. However naming conventions for C# is that properties are upper case. What is the recommended approach here, do you lower/upper case everything, or lower case only properties in Cosmos DB and not in your C# models or .. ? Is there any guidelines here?


Solution

  • There is no recommended approach or guidelines on naming. id is lowercase because it is a system property and _ts is prefixed with an underscore because it is a system meta property. The rest is completely up to you do decide.

    It comes down to how your application serialises and deserialises the data when it converts them from object to Json and visa versa. Keep in mind that the way your store the data in terms of naming is part of a contract with all the applications that consume it, so as long as you are consistent with how you are serialising your objects the case doesn't matter.