Use this procedure to upgrade from a previous version of Tiledesk server. You must manually execute the following upgrades depending on the starting version:
db.requests.update(
{ preflight : { $exists: false }},
{ $set: {"preflight": false} },
false,
true
)
db.requests.find( { participants: { $regex: /^bot_/ } } ).forEach(function(doc) {
doc.participantsBots = [doc.participants[0].replace("bot_","")];
doc.participantsAgents = [];
doc.hasBot = true;
db.requests.save(doc);
});
db.requests.find( { "participants": { "$not": /^bot_/ } }).forEach(function(doc) {
doc.participantsAgents = doc.participants;
doc.participantsBots = [];
doc.hasBot = false;
db.requests.save(doc);
});