-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Catalog and Routing
Anything trying to copy collection or indexes should be able to do so without needing to extra logic to perform any transformation (this logic should be handled under the hood, if such transformation is required).
Some examples of such api:
Example 1: call command for getting index option, call command for creating the index by feeding the previous result as-is.
Example 2: call command that copies index with hostName/shardName and collection as the input.
Providing command/set of commands to perform this would be most ideal so other tools like mongosync would be benefit from this as well.
Motivation: We have hit some CAs in the past that are very subtle and not obvious that they are incorrect just by looking at the resharding code for cloning collections/indexes. Some examples:
SERVER-90243: listCollections doesn't include the complete options to copy the collection correctly.
SERVER-89705: absence of collation from listIndex means simple collation, but if you didn't specify collation in createIndex, it means default collation. So passing in the index option from listIndex to createIndex directly can sometimes yield a different collation from the original index.