#!/bin/bash -e

. "node_modules/@pathable/pathable-scripts/scripts/_env.sh"
. "node_modules/@pathable/pathable-scripts/scripts/_lib.sh"

load_env "$HOME/.pathable-env"
load_env "private/env/$environment/.env"

which=$1
dest=$METEOR_PACKAGE_DIRS/../../config/db/reset

mongodump --out $dest --db pathable

if [ "${which}" = "schema-only" ]; then
  find $dest -name '*bson' -type f -exec cp /dev/null  {} \;
fi
