@task
def mongorestore(ctx, path, drop=False):
 db = settings.DB_NAME
 port = settings.DB_PORT
 cmd = 'mongorestore --db {db} --port {port}'.format(db=db, port=port, pty=True)
 if settings.DB_USER:
  cmd += ' --username {0}'.format(settings.DB_USER)
 if settings.DB_PASS:
  cmd += ' --password {0}'.format(settings.DB_PASS)
 if drop:
  cmd += ' --drop'
 cmd += (' ' + path)
 ctx.run(cmd, echo=True)

@ task def mongorestore ( ctx , path , drop = False ) : db = settings . DB_NAME port = settings . DB_PORT cmd = 'mongorestore --db {db} --port {port}' . format ( db = db , port = port , pty = True ) if settings . DB_USER : cmd += ' --username {0}' . format ( settings . DB_USER ) if settings . DB_PASS : cmd += ' --password {0}' . format ( settings . DB_PASS ) if drop : cmd += ' --drop' cmd += ( ' ' + path ) ctx . run ( cmd , echo = True )
restores the running osf database with the contents of the database at the location given its argument .