# Refreshing the data in development and deployment

One common development activity is “refreshing” the data in your application. This is straightforward, but the steps are a bit different depending upon whether you are refreshing your local development environment or refreshing the deployed application.

## Prerequisites

First, be sure that you have set up your system so that default data is loaded when the database is empty. In meteor-application-template-react, that code is located in Mongo.js and settings.development.json.

While it might be tempting to not bother with automatically loading sample data, resist this urge. Having a well crafted set of sample data that gets automatically loaded when the database is empty will help you find errors in your system more quickly and easily. You will work faster with good sample data.

Whenever you change the structure of your data model (i.e. you modify the set of fields associated with a collection, or add a new collection), you will need to update your sample data to conform to the new data model.

## Development mode

Refreshing the database in development mode is very easy:

1. Stop Meteor. Quit the meteor process by typing control-c.

2. Clear the database. Clear the database by running meteor reset in the command line in the directory containing your app.

3. Restart the app. Run meteor npm run start to run a script that will enable your system to be initialized with the data in your settings.development.json file.

4. Verify the refreshed database. Use Robo 3T to inspect the server database running on localhost:3001 to verify that the database is refreshed correctly. See Understanding data in development for more details on how to do that.

## Production mode

Refreshing the database in production mode is also easy, but it has one additional step, and the common steps are accomplished a little differently:

1. Update settings.production.json. The deployed application gets its default data from settings.production.json, not settings.development.json. So, your first step is normally to update this file to contain the most recent sample data.

2. Stop Meteor. To stop the deployed Meteor application, go to Galaxy, click on the “Settings” tab, then scroll down the page and click the “Stop” button in the “Stop App” section. You will need to confirm your desire to stop the app, then Galaxy will shut it down and replace the “Stop” button with a “Start” button.

3. Clear the database. To clear the database, go to the page associated with your database at mongodb.com, then click on “Collections” to display your “test” database and the associated Meteor collections inside it. Hover over a collection name and you will see a trash icon displayed next to the collection. Click the trash icon to delete the collection. You don’t have to delete collections that don’t contain any data.

4. Restart the app. To restart the app, you will need to redeploy it so that your updated settings.production.json file will be sent to Galaxy. To do this, just reinvoke a command like the following:

DEPLOY_HOSTNAME=galaxy.meteor.com meteor deploy testdeploypmj2.meteorapp.com --owner ics314f19 --settings ../config/settings.production.json

1. Verify the refreshed database. Use your browser or Robo 3T to inspect the server database running at mongodb.com to see that the database is refreshed correctly. See Understanding data in deployment for more details on how to do that.