Change ensureStructure maintenance script to use Mongoose