Skip to content

Instantly share code, notes, and snippets.

@ppetermann
Created November 11, 2012 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppetermann/4054791 to your computer and use it in GitHub Desktop.
Save ppetermann/4054791 to your computer and use it in GitHub Desktop.
Kingboard Update Database to fix involved fields that where string due to issue #24
db.Kingboard_Kill.find().forEach(
function(kill) {
var involvedCharacters = [];
var involvedCorporations = [];
var involvedAlliances = [];
var involvedFactions = [];
kill.involvedCharacters.forEach(
function(inv) {
if(typeof inv == 'string') inv = parseInt(inv);
involvedCharacters.push(inv);
}
);
kill.involvedCorporations.forEach(
function(inv) {
if(typeof inv == 'string') inv = parseInt(inv);
involvedCorporations.push(inv);
}
);
kill.involvedAlliances.forEach(
function(inv) {
if(typeof inv == 'string') inv = parseInt(inv);
involvedAlliances.push(inv);
}
);
kill.involvedFactions.forEach(
function(inv) {
if(typeof inv == 'string') inv = parseInt(inv);
involvedFactions.push(inv);
}
);
kill.involvedCharacters = involvedCharacters;
kill.involvedCorporations = involvedCorporations;
kill.involvedAlliances = involvedAlliances;
kill.involvedFactions = involvedFactions;
db.Kingboard_Kill.save(kill);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment