How can I maintain custom order of properties in Azure Cosmos DB instead of alphabetical order?
Harshit Gupta
60
Reputation points
In Cosmos DB, I want to store properties like 1. Key
, 2. Inside
, etc., in the order I define. However, Cosmos DB seems to automatically sort them alphabetically, which creates issues — especially when these documents are passed to LLMs that rely on the order of keys. Is there a way to prevent Cosmos DB from reordering the properties alphabetically? Or is there a recommended data structure approach that preserves the intended order?
Sign in to answer