trying this again
This commit is contained in:
parent
362a9702f4
commit
9127d8f553
1 changed files with 2 additions and 2 deletions
|
@ -26,13 +26,13 @@ mongoose.connection.on('error', () => {
|
||||||
|
|
||||||
const CHUNK = 1000;
|
const CHUNK = 1000;
|
||||||
Project.count({})
|
Project.count({})
|
||||||
.exec().then((numProjects) => {
|
.exec().then(async (numProjects) => {
|
||||||
console.log(numProjects);
|
console.log(numProjects);
|
||||||
for (let i = 0; i < numProjects; i += CHUNK) {
|
for (let i = 0; i < numProjects; i += CHUNK) {
|
||||||
let projects = await Project.find({}).skip(i).limit(CHUNK).exec();
|
let projects = await Project.find({}).skip(i).limit(CHUNK).exec();
|
||||||
projects.forEach((project, projectIndex) => {
|
projects.forEach((project, projectIndex) => {
|
||||||
console.log(project.name);
|
console.log(project.name);
|
||||||
project.files.forEach((file, fileIndex) => {
|
project.files.forEach((async file, fileIndex) => {
|
||||||
if (file.url && file.url.includes('p5.js-webeditor')) {
|
if (file.url && file.url.includes('p5.js-webeditor')) {
|
||||||
file.url = file.url.replace('p5.js-webeditor', process.env.S3_BUCKET);
|
file.url = file.url.replace('p5.js-webeditor', process.env.S3_BUCKET);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue