Migrate from MongoDB® to SingleStore

To migrate your collection from MongoDB® to SingleStore, you can perform the following tasks:

  • Replicate your MongoDB® collections using Change Data Capture (CDC).

  • Back up your collections using mongodump, and then restore the backup into your SingleStore Helios workspace using mongorestore.

  • Export your collection using mongoexport, and then import the exported data into your SingleStore Helios workspace using mongoimport.

Replicate MongoDB® Collections to SingleStore

SingleStore allows you to perform a one-time data replication or ongoing CDC (Change Data Capture) from MongoDB® collections into SingleStore. Refer to Replicate MongoDB® Collections to SingleStore for more information.

Use mongodump and mongorestore

Back Up Data using mongodump

You can back up your collections in the BSON format using the mongodump command-line tool. Run the mongodump command from the system command-line. Refer to mongodump for more information.

Here's a sample command to create a backup:

mongodump --uri="mongodb://<username>:<password>@<MongoDB_endpoint>:27017" \
--db=<database_name> --collection=<collection_name> \
--out=<path_to_output_directory>

For MongoDB® Atlas instances, use the mongodb+srv:// scheme. For example:

mongodump --uri="mongodb+srv://<username>:<password>@<MongoDB_Atlas_endpoint>" \
--db=<database_name> --collection=<collection_name> \
--out=<path_to_output_directory>

Restore the Backup using mongorestore

To restore the backup of your MongoDB® collections created using mongodump into your SingleStore Helios workspace, use the mongorestore command-line tool. Run the mongorestore command from the system command-line. Refer to mongorestore for more information.

Note

Do not restore and build the indexes specified in the backup. Use the --noIndexRestore option to ignore the indexes in the backup. To create indexes in SingleStore, use the CREATE INDEX command instead.

Here's a sample command to restore your MongoDB® backup into SingleStore:

mongorestore \
--uri 'mongodb://<user>:<password>@<SingleStore_Kai_endpoint>:27017/<target_database>?authMechanism=PLAIN&tls=true&loadBalanced=true' \
--noIndexRestore --ssl <path_to_backup>

Use mongoexport and mongoimport

Export Data using mongoexport

You can export your collection in either JSON or CSV format using the mongoexport command-line tool. Run the mongoexport command from the system command-line. Refer to mongoexport for more information.

Run the following command to export collections from a MongoDB® endpoint:

mongoexport --uri='mongodb://<user>:<password>@<MongoDB_endpoint>:27017' \
--db=<database_name> --collection=<collection_name> \
--out=<path_to_output/filename.[json|csv]>

Run the following command to export collections from a MongoDB® Atlas endpoint:

mongoexport --uri mongodb+srv://<username>@<atlas_endpoint>/<database_name> \
--collection=<collection_name> --out=<path_to_output/filename.[json|csv]>

Import Data using mongoimport

To import the data exported using mongoexport into your SingleStore Helios workspace, use the mongoimport command-line tool. mongoimport supports Extended JSON, CSV, and TSV formats that have been exported via mongoexport. Run the mongoimport command from the system command-line. Refer to mongoimport for more information.

mongoimport \
--uri 'mongodb://<user>:<password>@<SingleStore_Kai_endpoint>:27017/?authMechanism=PLAIN&tls=true&loadBalanced=true' \
--db <database_name> --collection <collection_name> \
--file <path_to_import_file/filename.[json|csv]>

If your file contains arrays, add --jsonArray after the database name.

Last modified: March 13, 2024

Was this article helpful?

Verification instructions

Note: You must install cosign to verify the authenticity of the SingleStore file.

Use the following steps to verify the authenticity of singlestoredb-server, singlestoredb-toolbox, singlestoredb-studio, and singlestore-client SingleStore files that have been downloaded.

You may perform the following steps on any computer that can run cosign, such as the main deployment host of the cluster.

  1. (Optional) Run the following command to view the associated signature files.

    curl undefined
  2. Download the signature file from the SingleStore release server.

    • Option 1: Click the Download Signature button next to the SingleStore file.

    • Option 2: Copy and paste the following URL into the address bar of your browser and save the signature file.

    • Option 3: Run the following command to download the signature file.

      curl -O undefined
  3. After the signature file has been downloaded, run the following command to verify the authenticity of the SingleStore file.

    echo -n undefined |
    cosign verify-blob --certificate-oidc-issuer https://oidc.eks.us-east-1.amazonaws.com/id/CCDCDBA1379A5596AB5B2E46DCA385BC \
    --certificate-identity https://kubernetes.io/namespaces/freya-production/serviceaccounts/job-worker \
    --bundle undefined \
    --new-bundle-format -
    Verified OK