How can i get the shard key of the collections that created in a shard cluster

i create db, its struct dump from another db , i want to verify them , so what I should do ? i write it with pymongo , i finished some part and i coudn’t swith to other program language .

Hi @feng_deng welcome to the community!

As I understand it, you dumped a collection from a sharded cluster using Pymongo, and you wanted to see the shard key of that collection?

If yes, your Python script would also need to dump the indexes defined on that collection using the index_information() pymongo method as well as the data itself.

Notably, mongodump does this (export data + indexes), but not mongoexport, since mongoexport is more concerned about the data themselves and not the metadata (which would include index definitions).

If this is not what you’re looking for, could you please elaborate more on what you require? A description of the process and some examples (documents/code) would be most helpful.

Best regards
Kevin

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.