public function down()
 {
     $db = \DB::getMongoDB();
     Lrs::get()->each(function (Lrs $lrs) use($db) {
         $users = $lrs->getAttribute('users');
         foreach ($users as &$user) {
             $user['_id'] = (string) $user['_id'];
         }
         $lrs->setAttribute('users', $users);
         $lrs->owner_id = (string) $lrs->owner_id;
         $lrs->save();
         echo 'IDs for lrs collection "' . $lrs->title . '" converted to strings.' . PHP_EOL;
     });
 }
 public function down()
 {
     $db = \DB::getMongoDB();
     Lrs::get()->each(function (Lrs $lrs) use($db) {
         $convertToString = function ($value) {
             return (string) $value;
         };
         $this->changeForeignKey($db->statements, 'lrs_id', 'lrs._id', $lrs->_id, $convertToString);
         $this->changeForeignKey($db->documentapi, 'lrs_id', 'lrs', $lrs->_id, $convertToString);
         $this->changeForeignKey($db->reports, 'lrs_id', 'lrs', $lrs->_id, $convertToString);
         $this->changeForeignKey($db->exports, 'lrs_id', 'lrs', $lrs->_id, $convertToString);
         $lrs->owner = ['_id' => $convertToString($lrs->owner_id)];
         $lrs->save();
         echo 'Models for "' . $lrs->title . '" converted.' . PHP_EOL;
     });
     echo 'All finished, hopefully!' . PHP_EOL;
 }