First you’ll need to install the MongoDB dependencies as shown here.
pip install "unstructured[mongodb]"

Run Locally

The upstream connector can be any of the ones supported, but for convenience here, showing a sample command using the upstream local connector.
#!/usr/bin/env bash

EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}

unstructured-ingest \
  local \
  --input-path example-docs/book-war-and-peace-1225p.txt \
  --output-dir local-output-to-mongodb \
  --strategy fast \
  --chunk-elements \
  --embedding-provider "$EMBEDDING_PROVIDER" \
  --num-processes 2 \
  --verbose \
  mongodb \
  --uri "$MONGODB_URI" \
  --database "$MONGODB_DATABASE_NAME" \
  --collection "$DESTINATION_MONGO_COLLECTION"
For a full list of the options the CLI accepts check unstructured-ingest <upstream connector> mongodb --help. NOTE: Keep in mind that you will need to have all the appropriate extras and dependencies for the file types of the documents contained in your data storage platform if you’re running this locally. You can find more information about this in the installation guide.