Comment on page
MongoDB
This page describes how to create and maintain connections to your MongoDB database.
Before ingesting your data from MongoDB, you must establish a connection to your database.
A MongoDB connection can be created as follows:
CREATE MONGODB CONNECTION my_mongodb_connection
CONNECTION_STRING = 'mongodb+srv://cluster0.example.mongodb.net/testdb1'
USER_NAME = '<user_name>'
PASSWORD = '<password>';
After you have created your connection, you are ready to move on to the next step of building your data pipeline: reading your data into Upsolver with an ingestion job.
Some connection options are considered mutable, meaning that in some cases, you can run a SQL command to alter an existing MongoDB connection rather than create a new one.
To change the database you are connecting to but keep everything else the same without having to create an entirely new connection, you can run the following command:
ALTER MONGODB CONNECTION my_mongodb_connection
SET CONNECTION_STRING = 'mongodb+srv://cluster0.example.mongodb.net/testdb2'
For a full list of connection options with syntax and detailed descriptions, see the SQL command reference for MongoDB.
If you no longer need a connection you can easily drop it with the following SQL command:
DROP CONNECTION my_mongodb_connection;
However, note that if existing tables or jobs depend upon the connection, the connection cannot be dropped.
Last modified 3mo ago