Default indexing in Cosmos DB
I recently needed some paging functionality in Cosmos DB, since skip and take is not directly supported we're using a cursor based paging based on a date time. While testing my repository I suddenly did not get the results I expected. After a little bit of trial and error with the Query Explorer in the portal I noticed somethign important
Creating collections with the SDK will not use the same index configuration as collections created through the portal.
I had added code to create the collection automatically, and after testing this my collection used the "old" index settings.
I have blogged about this earlier, http://blog.ulriksen.net/indexing-changes-in-documentdb/ but totally forgotten about it since then.
So, how do you create a new collection with default indexing using the .NET SDK?
I did a shout out to the Azure Cosmos DB team, and they confirmed this will change
And yes, the plan is to change the SDK defaults so that they're the same.
— Azure Cosmos DB (@AzureCosmosDB) June 21, 2017