From 14d1c33951edd22caa1975adb683c0b43d25d2f6 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Tue, 13 Dec 2016 20:36:48 -0500 Subject: [PATCH] more s3 script testing --- server/utils/db_reformat.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/utils/db_reformat.js b/server/utils/db_reformat.js index d1beb6f9..0ae45407 100644 --- a/server/utils/db_reformat.js +++ b/server/utils/db_reformat.js @@ -1,5 +1,6 @@ import mongoose from 'mongoose'; import path from 'path'; +import { uniqWith, isEqual } from 'lodash'; require('dotenv').config({path: path.resolve('.env')}); const ObjectId = mongoose.Types.ObjectId; mongoose.connect('mongodb://localhost:27017/p5js-web-editor'); @@ -26,7 +27,7 @@ let client = s3.createClient({ }, }); -const s3Files = []; +let s3Files = []; Project.find({}) .exec((err, projects) => { @@ -38,6 +39,8 @@ Project.find({}) }); }); console.log(s3Files.length); + s3Files = uniqWith(s3Files, isEqual); + console.log(s3Files.length); }); const uploadedFiles = [];