1.44.0, 1.45.0 - Asta7 Core

Highlights:

https://stiftelsenasta.atlassian.net/browse/AAM-1120

https://stiftelsenasta.atlassian.net/browse/AAM-1127

Bug fixes:

https://stiftelsenasta.atlassian.net/browse/AAM-1120

Storys:

https://stiftelsenasta.atlassian.net/browse/AAM-1127

Tasks:

https://stiftelsenasta.atlassian.net/browse/AAM-1099

https://stiftelsenasta.atlassian.net/browse/AAM-1098

Removing duplicates from MongoDB

A new constraint has been added to MongoDB in this version to avoid duplicates. If there are already duplicates those have to be removed before upgrading. The following script can be used for that.

const indexName = db.fs.files.createIndex({ 'filename': 1, 'metadata._projectId': 1, 'metadata._category': 1 }); db.fs.files.aggregate([ { $group: { _id: {filename: '$filename', category: '$metadata._category', projectId: '$metadata._projectId'}, dups: {'$addToSet': '$_id'}, count: {'$sum': 1}, latest: {'$max': '$uploadDate'} } }, { $match: { count: {'$gt': 1} } } ], {allowDiskUse: true} ).forEach(function (document) { const duplicateIds = document.dups; db.fs.files.find({_id: {$in: duplicateIds}}) .sort({uploadDate: 1}) .skip(1) .forEach(function (fileDocument) { db.fs.chunks.deleteMany({files_id: fileDocument._id}); db.fs.files.deleteMany({_id: fileDocument._id}); }); }); db.fs.files.dropIndex(indexName);

How to upgrade

  1. Go to the currently running asta7 directory and run the following script

2. Upgrade to 1.44.0 and run the following commands to start

docker-compose pull docker-compose build docker-compose up -d