2013-08-09 10:10:19 +00:00
|
|
|
{db, ObjectId} = require "./app/coffee/mongojs"
|
|
|
|
ConversionManager = require "./app/coffee/ConversionManager"
|
2013-08-09 10:36:19 +00:00
|
|
|
async = require "async"
|
2013-08-08 15:42:14 +00:00
|
|
|
|
2013-08-09 10:36:19 +00:00
|
|
|
db.docOps.find { }, { doc_id: true }, (error, docs) ->
|
|
|
|
throw error if error?
|
|
|
|
jobs = []
|
|
|
|
for doc in docs
|
|
|
|
do (doc) ->
|
|
|
|
jobs.push (callback) ->
|
|
|
|
doc_id = doc.doc_id.toString()
|
2013-08-09 12:27:35 +00:00
|
|
|
ConversionManager.convertOldRawUpdates doc_id, (error) ->
|
2013-08-09 10:36:19 +00:00
|
|
|
return callback(error) if error?
|
|
|
|
console.log doc_id, "DONE"
|
2013-08-09 12:54:30 +00:00
|
|
|
callback()
|
2013-08-09 10:36:19 +00:00
|
|
|
async.series jobs, (error) ->
|
2013-08-08 15:42:14 +00:00
|
|
|
throw error if error?
|
|
|
|
process.exit()
|
2013-08-09 10:10:19 +00:00
|
|
|
|
2013-08-08 15:42:14 +00:00
|
|
|
|