This tool can be run as a cron-job on Northflank to perform an archive setup similar to the Atlas offering.
This requires the environment variable ARCHIVE_CONFIGURATION which is a json string with the following type:
export interface InputSource {
sourceCluster: string;
destinationCluster: string;
archiveSources: ArchiveSource[];
}
export interface ArchiveSource {
database: string;
collection: string;
field: string;
archiveDays: number;
}
sourceClustershould be theMONGO_SRV_ADMINof the source cluster which data will be taken fromdestinationClustershould be theMONGO_SRV_ADMINof the archive clusterarchiveSourcesis an array of collections which will have documents archived whendocument.[field]is older than archiveDays