...
Get the MongoDB URIs
Obtain the source MongoDB URI in the format:
mongodb+srv://<username>:<password>@<source-cluster>
Get the MongoDB target URI in format from the Galaxy Database team:
mongodb://<username>:<password>@<destination-host>:<port>
Validate the number of documents.
We can validate the number of documents inside a MongoDB with the following script.
Code Block |
---|
var db = db.getSiblingDB('DATABASE_NAME'); // Connect to the specified database
var collections = db.getCollectionNames(); // Get all collections in the database
var totalDocuments = 0;
for (var coll of collections) {
totalDocuments += db.getCollection(coll).countDocuments(); // Sum the document count for each collection
}
print("Total documents in DATABASE_NAME: " + totalDocuments); // Print the total document count |
Info |
---|
This entire migration procedure should not be used for MongoDB Sharded clusters. |
Run the Docker Container
Use the following command to run the migration container:
Code Block language sh docker run --rm \ -e SOURCE_URI="" \ -e TARGET_URI="" \ -e DB_NAME="simpletask" \ meteor/galaxy-mongodb-migrate:202409101534
Replace
SOURCE_URI
,TARGET_URI
, andDB_NAME
with your actual values.
...