Skip to content

Commit 904d073

Browse files
committed
Fixes invalid JSON format data exporting
1 parent 8740a30 commit 904d073

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

seed/get-challenge-completion.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ MongoClient.connect(secrets.db, function(err, database) {
1717
if (err) {
1818
throw err;
1919
}
20+
var firstTime = true;
21+
2022
var stream = database.collection('user')
2123
.find({'completedChallenges': { $ne: null },
2224
'isLocked': { $ne: true } },
@@ -36,7 +38,12 @@ MongoClient.connect(secrets.db, function(err, database) {
3638
});
3739
});
3840
if (dataOut.length) {
39-
console.log(JSON.stringify(dataOut) + ',');
41+
if (!firstTime) {
42+
console.log(',' + JSON.stringify(dataOut));
43+
} else {
44+
firstTime = false;
45+
console.log(JSON.stringify(dataOut));
46+
}
4047
}
4148
}
4249
}).on('end', function() {

0 commit comments

Comments
 (0)