code: function removeOthers(mongoose, model, retainedNames) {
      //console.log('here collectionname' + Object.keys(model));
      //console.log('here collectionname' + model.collectionname);
      return model.aggregate({ $project: { modelname: 1 } }).then((r) => r.map(o => o.modelname)).then((modelnames) => {
          debuglog(" present models " + modelnames.length + ' ' + modelnames);
          var delta = _.difference(modelnames, retainedNames);
          debuglog(' spurious models' + delta.length + ' ' + delta);
          if (delta.length === 0) {
              return Promise.resolve(true);
          }
          return Promise.all(delta.map(modelname => model.remove({ modelname: modelname })));
      });
  }
docs: export function getModelNames(model : mongoose.model, )