Data Federation is MongoDB’s solution for querying data stored in low-cost S3 buckets, Atlas clusters, HTTP stores, and Atlas Data Lake datasets using the MongoDB Query Language. This allows applications to store data in the appropriate storage solution for their use case.
How it works…
Data Federation creates virtual databases and collections based on data from MongoDB Atlas clusters, Atlas Data Lake, and cloud storage.
NOTE: IF YOU WANT TO COMBINE TWO DIFFERENT COLLECTIONS IN THE SAME DATABASE. I RECOMMEND THAT YOU USE THE $LOOKUP AGGREGATION QUERY.
Prerequisites :
Before you start, you must have the following:
i: There should be at least two M10 clusters in MongoDB Atlas.
ii: The Project owner’s role should be to create the Federated database instance.
Procedure :
In order to navigate to the Data Federation page follow the below steps:
i: Log in to MongoDB Atlas cloud.
ii: Go to ‘Data Federation’ under the ‘SERVICES’ tab from the navigation.
iii: Click the ‘Create Federation Database’ button to create a new Federated Database Instance.
iv: Click ‘Add Data Source’ to add Atlas clusters.
v: Click ‘MongoDB Atlas Cluster’ to choose the cluster and select the databases or collections.
vi: Drag the datasets in Virtual Collection from the Cluster Store and click the ‘Save’ button.
vii: Federated Database Instance has been created.
viii: Click ‘Connect’ to make connections.
ix: Choose your preference to connect the virtual database.
x: For the connection, I’m using MongoDB Compass and Copying the connection string.
NOTE: YOU NEED TO ADD THE PASSWORD OF USER IN CONNECTION STRING.
xi: After connection, the MongoDB Atlas Data Federation overview page shows the information of the Virtual Database.
Nothing is impossible, Keep Learning……