Created
August 26, 2012 09:04
-
-
Save ppetermann/3476435 to your computer and use it in GitHub Desktop.
Kingboard Update Database to contain involved fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.Kingboard_Kill.find().forEach( | |
function (document) { | |
involvedCorporations = new Array(); | |
involvedCharacters = new Array(); | |
involvedFactions = new Array(); | |
involvedAlliances = new Array(); | |
document.attackers.forEach(function (attacker) { | |
if(involvedCorporations.indexOf(attacker.corporationID) == -1) | |
involvedCorporations.push(attacker.corporationID); | |
if(involvedCharacters.indexOf(attacker.characterID) == -1) | |
involvedCharacters.push(attacker.characterID); | |
if(!involvedFactions.indexOf(attacker.factionID) == -1) | |
involvedFactions.push(attacker.factionID); | |
if(!involvedAlliances.indexOf(attacker.allianceID) == -1) | |
involvedAlliances.push(attacker.allianceID); | |
}) | |
involvedCorporations.push(document.victim.corporationID); | |
involvedCharacters.push(document.victim.characterID); | |
involvedFactions.push(document.victim.factionID); | |
involvedAlliances.push(document.victim.allianceID); | |
document.involvedCorporations = involvedCorporations; | |
document.involvedCharacters = involvedCharacters; | |
document.involvedFactions = involvedFactions; | |
document.involvedAlliances = involvedAlliances; | |
db.Kingboard_Kill.save(document); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment