2
0
itizawa 6 жил өмнө
parent
commit
6fa63f4cd8

+ 7 - 3
src/migrations/20191126173013-adjust-pages-path.js → src/migrations/20191126173016-adjust-pages-path.js

@@ -16,12 +16,16 @@ module.exports = {
     // retrieve target data
     // retrieve target data
     const pages = await Page.find({ path: /^(?!\/)/ });
     const pages = await Page.find({ path: /^(?!\/)/ });
 
 
-    logger.info(pages);
 
 
     // create requests for bulkWrite
     // create requests for bulkWrite
     const requests = pages.map((page) => {
     const requests = pages.map((page) => {
-      // logger.info(page);
-      return pathUtils.addHeadingSlash(page.path);
+      const adjustedPath = pathUtils.addHeadingSlash(page.path);
+      return {
+        updateOne: {
+          filter: { _id: page._id },
+          update: { $set: { path: adjustedPath } },
+        },
+      };
     });
     });
 
 
     if (requests.length > 0) {
     if (requests.length > 0) {