Created
August 9, 2012 12:39
-
-
Save Almad/3303863 to your computer and use it in GitHub Desktop.
cmd fix approach
This file contains hidden or 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
async = require 'async' | |
datamodel= require '../lib/datamodel' | |
mongoose = require 'mongoose' | |
Traffic = mongoose.model 'Traffic' | |
mongoose.connection.once 'open', -> | |
Traffic.find {}, (err, traffic) -> | |
async.forEach traffic, (hit, done) -> | |
hit.fixSomething | |
hit.save done | |
, (err) -> | |
console.error "#{traffic?.length} traffic objects updated." | |
datamodel.disconnect() | |
if err then throw err | |
datamodel.connect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment