Skip to content

Instantly share code, notes, and snippets.

@kaworu
Last active October 12, 2016 13:39
Show Gist options
  • Save kaworu/ed99c55ed094005b47ab1c61526b66ed to your computer and use it in GitHub Desktop.
Save kaworu/ed99c55ed094005b47ab1c61526b66ed to your computer and use it in GitHub Desktop.
db.tickets.find({'contact.portrait': {$exists: true}}).snapshot().forEach(
function (ticket) {
var rfc2397_portrait = 'data:' + ticket.contact.portrait['mime-type'] + ";base64," + ticket.contact.portrait.data.base64();
db.tickets.update({_id: ticket._id},
{
$set: {
'contact.rfc2397_portrait': rfc2397_portrait,
},
$unset: {
'contact.portrait': true,
},
}
);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment