I would like to archive multiple collections form the same database in Atlas Online Archive.
Do I have to create a separate archive for every database collection?
If i do so, can I have the same URL connection link to all online archives that belong to the same database?
Hi @mark_babayev,
When configuring the Online Archive, you’ll be required to enter the namespace of the data in which you plan to archive. If they’re from the same database, you’ll just need to create multiple archives (since the collection names will be different, the namespace will be different).
As per the linked docs:
For each archive, Atlas runs a query in the archive’s namespace to identify the documents that match the criteria for archiving.
Example below:
In my test environment, I have 2 collections in the same database test
:
coll1
coll2
The following namespaces are used for my online archives:
test.coll1
test.coll2
From the Atlas UI perspective:
Once these were configured and documents were archived, I hit the Connect
(shown in the above UI) and chose Connect to Online Archive
(via Shell in my case). I used the single connection string that was given and had access to both of the archives.
The archives with the same database name (but different collection names) will appear as 2 separate namespaces similar to the non-archived data:
Connecting to: mongodb://<credentials>@archived-atlas-online-archive-65446abff62e6947921460af-7zymd.a.query.mongodb.net/?directConnection=true&tls=true&authSource=admin&appName=mongosh+2.1.0
Using MongoDB: 7.0.0
Using Mongosh: 2.1.0
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
AtlasDataFederation test> show collections
coll1
coll2
AtlasDataFederation test> db.coll1.find({},{_id:0})
[ { date: ISODate('2023-01-01T00:00:00.000Z') } ]
AtlasDataFederation test> db.coll2.find({},{_id:0})
[ { date: ISODate('2023-01-01T00:00:00.000Z') } ]
Note: Test data was archived from an Atlas cluster on a date field.
Regards,
Jason
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.