Skip to content

Instantly share code, notes, and snippets.

@mpobrien
Created December 29, 2015 19:13
Show Gist options
  • Save mpobrien/f238887efbc8d7a09207 to your computer and use it in GitHub Desktop.
Save mpobrien/f238887efbc8d7a09207 to your computer and use it in GitHub Desktop.
function migrateBaselines(from_project, to_project){
var migration_id = new ObjectId()
print("using migration id", migration_id)
var baselines = db.json.find({project_id:from_project,tag:{$exists:true, $ne:""}})
while(baselines.hasNext()){
var n = baselines.next()
delete n._id
n.project_id = to_project
n.from_migration_id = migration_id
db.json.insert(n)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment