Created
October 8, 2021 18:42
-
-
Save oeo/179a28905befff5201ff23263ad7c373 to your computer and use it in GitHub Desktop.
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
process.env.SILENCE = 1 | |
_ = require('wegweg')({ | |
globals: on | |
shelljs: on | |
}) | |
log = (x...) -> try console.log x... | |
_help = -> | |
log """ | |
Usage ./ ENV=dk-prod --out <filename> | |
""" | |
exit 0 | |
if _.arg('help') then _help() | |
if !_.arg('out') | |
throw new Error '--out required' | |
exit 1 | |
############################## | |
require '../../../dev' | |
require '../../core/globals' | |
############################## | |
fields = [ | |
'event' | |
'ip' | |
'ctime' | |
'LANDING_PAGE_ROUTE' | |
] | |
if _.exists(_.arg('out')) | |
try rm _.arg('out') | |
command = """ | |
mongoexport --uri "#{process.env.MONGODB_URI}" \ | |
-vvvv \ | |
--type json \ | |
--collection events \ | |
--fields "#{fields.join(',')}" \ | |
--forceTableScan \ | |
--out #{_.arg('out')} | |
""" | |
log command | |
exec command | |
log 'Finished' | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment