We have gone through quite a bit of Azure Cosmos-related posts the last few weeks, but we have skipped over the concept of partition keys in almost of the queries we have covered.
Ignoring the partition key is probably fine for these small data sets, but for real workloads we should probably think this through.
A good example of a partition key would be a customer id in a multi-tenant system. That would allow you to partition the data by customer, which would often be a good approach to this situation.
Using a partition key in a query is pretty easy. Just remove the EnableCrossPartitionQuery option and pass the partition key.
Now the above assumes we configured a partition key. When did we do that? Well when we create the collection we set which property will be the partition key.
Remember to pick a logical partition key for your data. Think of something that will divide your data into groups. Also, remember that partitions are transaction boundaries. Pick a partition key that should require you to query across the partition keys on a regular basis.
For further reading, check out https://docs.microsoft.com/en-us/azure/cosmos-db/partition-data.