When you are working with the RavenDB in a sharded environment, the document ids will include the shard id such as europe/companies/21
. It's also documented on the RavenDB site:
ModifyDocumentId: lets you store the shard id for a document in the document itself. The default implementation is: (convention, shardId, documentId) => shardId + convention.IdentityPartsSeparator + documentId
By doing that, I am guessing RavenDB is figuring out smart querying techniques and can specifically target the proper shard which is great. However, I have a few questions which I am unable to answer:
How about if I need to move a document to a new shard? That would change the key and break URLs that have used the key as asked here.
I may start with only one server and then later, I may decide to implement sharding. So, in that case the keys will change (?) or smart querying will not work (?).
What are the general advises on those concerns and how are these problems are solved?