|
|
@@ -56,6 +56,27 @@ schema.statics.retrievePageRedirectEndpoints = async function(fromPath: string):
|
|
|
},
|
|
|
},
|
|
|
]);
|
|
|
+ /* ---------- aggResult example ----------
|
|
|
+ {
|
|
|
+ "_id" : ObjectId("62e5650d6134d37aa0935e6d"),
|
|
|
+ "fromPath" : "/page1",
|
|
|
+ "toPath" : "/page2",
|
|
|
+ "chains" : [
|
|
|
+ {
|
|
|
+ "_id" : ObjectId("62e5651b6134d37aa0935e7a"),
|
|
|
+ "fromPath" : "/page2",
|
|
|
+ "toPath" : "/page3",
|
|
|
+ "depth" : NumberLong(0)
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "_id" : ObjectId("62e565256134d37aa0935e80"),
|
|
|
+ "fromPath" : "/page3",
|
|
|
+ "toPath" : "/Sandbox",
|
|
|
+ "depth" : NumberLong(1)
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ */
|
|
|
|
|
|
if (aggResult.length === 0) {
|
|
|
return null;
|
|
|
@@ -91,6 +112,35 @@ schema.statics.removePageRedirectsByToPath = async function(toPath: string): Pro
|
|
|
},
|
|
|
},
|
|
|
]);
|
|
|
+ /* ---------- aggResult example ----------
|
|
|
+ // 1
|
|
|
+ {
|
|
|
+ "_id" : ObjectId("62e565256134d37aa0935e80"),
|
|
|
+ "fromPath" : "/page3",
|
|
|
+ "toPath" : "/page4",
|
|
|
+ "chains" : [
|
|
|
+ {
|
|
|
+ "_id" : ObjectId("62e5651b6134d37aa0935e7a"),
|
|
|
+ "fromPath" : "/page2",
|
|
|
+ "toPath" : "/page3",
|
|
|
+ "depth" : NumberLong(0)
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "_id" : ObjectId("62e5650d6134d37aa0935e6d"),
|
|
|
+ "fromPath" : "/page1",
|
|
|
+ "toPath" : "/page2",
|
|
|
+ "depth" : NumberLong(1)
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ // 2
|
|
|
+ {
|
|
|
+ "_id" : ObjectId("62e5937a6134d37aa0936405"),
|
|
|
+ "fromPath" : "/org/page4",
|
|
|
+ "toPath" : "/page4",
|
|
|
+ "chains" : []
|
|
|
+ }
|
|
|
+ */
|
|
|
|
|
|
if (aggResult.length === 0) {
|
|
|
return;
|