Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Drop collections when replicating db
Browse files Browse the repository at this point in the history
By default `mongorestore` appends data to collections if they already
exist. This flag ensures the collection is dropped.
  • Loading branch information
robyoung committed Sep 4, 2013
1 parent 67afe21 commit 98b2dcd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions replicate-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ tar xzvf $FILENAME

if [ -z "$2" ]; then
pushd ../puppet/development
vagrant ssh -c "cd /var/govuk/backdrop && mongorestore ${DUMPDIR}"
vagrant ssh -c "cd /var/govuk/backdrop && mongorestore --drop ${DUMPDIR}"
popd
else
mongorestore -h $DESTINATION_HOST $DUMPDIR
mongorestore --drop -h $DESTINATION_HOST $DUMPDIR
fi

# cleanup locally
Expand Down

0 comments on commit 98b2dcd

Please sign in to comment.