@@ -46,8 +46,8 @@ private int getMongoDBVersion() {
46
46
private void archiveForVersion5AndAbove (Instant thresholdDate ) {
47
47
log .info ("Running archival for MongoDB version >= 5" );
48
48
49
- MongoCollection <Document > sourceCollection = mongoTemplate .getDb ().getCollection ("applicationHistorySnapshotTS " );
50
- MongoCollection <Document > targetCollection = mongoTemplate .getDb ().getCollection ("applicationHistorySnapshot " );
49
+ MongoCollection <Document > sourceCollection = mongoTemplate .getDb ().getCollection ("applicationHistorySnapshot " );
50
+ MongoCollection <Document > targetCollection = mongoTemplate .getDb ().getCollection ("applicationHistorySnapshotTS " );
51
51
52
52
long totalDocuments = sourceCollection .countDocuments (Filters .lte ("createdAt" , thresholdDate ));
53
53
log .info ("Total documents to archive: {}" , totalDocuments );
@@ -91,7 +91,7 @@ private void archiveForVersion5AndAbove(Instant thresholdDate) {
91
91
private void archiveForVersionBelow5 (Instant thresholdDate ) {
92
92
log .info ("Running archival for MongoDB version < 5" );
93
93
94
- MongoCollection <Document > sourceCollection = mongoTemplate .getDb ().getCollection ("applicationHistorySnapshotTS " );
94
+ MongoCollection <Document > sourceCollection = mongoTemplate .getDb ().getCollection ("applicationHistorySnapshot " );
95
95
96
96
long totalDocuments = sourceCollection .countDocuments (Filters .lte ("createdAt" , thresholdDate ));
97
97
log .info ("Total documents to archive: {}" , totalDocuments );
@@ -119,7 +119,7 @@ private void archiveForVersionBelow5(Instant thresholdDate) {
119
119
.append ("modifiedBy" , document .get ("modifiedBy" ))
120
120
.append ("updatedAt" , document .get ("updatedAt" ))
121
121
.append ("id" , document .get ("id" ))),
122
- new Document ("$out" , "applicationHistorySnapshot " )
122
+ new Document ("$out" , "applicationHistorySnapshotTS " )
123
123
)).first ();
124
124
} catch (Exception e ) {
125
125
log .error ("Failed to aggregate and insert document with ID {}. Error: {}" , document .getObjectId ("id" ), e .getMessage ());
0 commit comments