How to fix checklist items after upgrade?


#1

I upgraded from 0.48 to 0.95. It looks like the checklist schema was renormalized to pull out checklistItems as a separate Mongo collection. Each list now appears with its title (eg “A list”), and the checklist items have that same text.

Is there a script or query to pull the correct checklistItems titles from my backups? Thanks.


#2

Fix: load your old db.checklists into db.checklistsOld. Use the following script in Robo3T:

db.checklistsOld.find({}, {"_id": 1, "items.title":1, "items.sort": 1 }).forEach( (list, i, lists) => { 
  var checklistId = list._id;
  list.items.forEach( (item, j, items) => {
      var sort = item.sort,
          title = item.title;
      db.checklistItems.update({"checklistId": checklistId, "sort":sort}, {$set: {"title": title}} );
  });

});

Depending on how many items you have, you may need to adjust “shellTimeoutSec” in Robo3T (https://github.com/Studio3T/robomongo/wiki/Robomongo-Config-File-Guide)