Context
As requested in https://github.com/langchain-ai/langchain-mongodb/issues/117, we can enable sharding support by having an optional shard_key parameter in our checkpointer, which has the effect of running shardCollection on each of the collections used by the checkpointer.
Sample code:
# Enable sharding on the database database_name = 'your_database' client.admin.command('enableSharding', database_name) # Shard the collection collection_name = 'your_collection' shard_key = {'your_shard_key': 1} # Specify your shard key client.admin.command('shardCollection', f'{database_name}.{collection_name}', key=shard_key)
Definition of done
Enable the feature and test with local and remote Atlas.
Pitfalls
None