Merge pull request #3060 from overleaf/cmg-wfh-export-updates

WFH Export: Account for user being undefined

GitOrigin-RevId: 8e653fda6eaea3cdde8e5677f24ef39c1c97bb94
This commit is contained in:
Timothée Alby 2020-07-28 11:37:24 +02:00 committed by Copybot
parent 21de9041fe
commit 52fafa96c5

View file

@ -28,12 +28,16 @@ db.deletedSubscriptions.aggregate(
10,
function(userId, callback) {
db.users.findOne(userId, function(err, user) {
const emails = user.emails.map(email => email.email)
console.log(
`${user._id},${user.first_name || ''},${user.last_name || ''},${
user.signUpDate
},${emails.join(',')}`
)
if (user) {
const emails = user.emails.map(email => email.email)
console.log(
`${user._id},${user.first_name || ''},${user.last_name || ''},${
user.signUpDate
},${emails.join(',')}`
)
} else {
console.error('A group user was not found')
}
callback(err)
})
},