[LangGraph] Add Optional Sharding Support

XMLWordPrintableJSON

    • None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      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

            Assignee:
            Steve Silvester
            Reporter:
            Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: