# Datastores

Information saved to AirData is stored in [Org](../../../administration/airkit-organizations)-level collections called Datastores. Datastores cluster objects by [Profile](https://github.com/airkit/airkit-docs/blob/master/docs/v18-3/publish-and-manage-deployments.md) rather than application, allowing:

* the sharing of information between applications, and
* the separation of information collected by different deployments of the same app.

All applications within an Org have access to the same Datastores.

## Datastores and Profiles

Each Organization comes pre-configured with three default pre-built Datastores, one associated with each out-of-the-box profile:

* Development
* QA
* Production

Each profile is automatically connected to the corresponding Datastore. These pre-configured Datastores and profiles enable you to easily work with separate containers of data that tie to one application. For example, when building out an application and storing a user's contact information in AirData, app builders are able to use the **Development** profile to test writing data back to AirData. Then when ready to test, app builders can change the profile to **QA** and write data to the **QA** Datastore, and, when ready for production, the profile can be changed to **Production** to write to the **Production** Datastore.&#x20;

Profiles contain the configuration information for a published instance of an application. You can modify the profile being accessed in the Studio by selecting a profile from the Profile Selection dropdown menu at the center top of the Studio, next to the application name.

![organizing info](https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-46c780f8aba3bc7baf19e163857f6ba0b6b48060%2Fdatastores-v183-0.png?alt=media)

New Datastores are created directly in the [AirData Builder](../../../studio/studio/builder-bar/airdata-builder), by clicking on the '+' button to the right of the **App Objects** section in the Tree, and then selecting **Create Datastore** from the dropdown menu that appears.

![](https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-c05703e616200c60e07ff65a7cc265509c89e1a5%2Fdatastores-v183-1.png?alt=media)

To bind a profile to a new Datastore, select the profile in the Profile Selection menu and select the desired Datastore in [**Settings**](../../../studio/studio/builder-bar/settings) **> Datastore**. Upon saving, this will bind the Datastore to the Profile.

![](https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-827f6951d9ebe42a19968aabb87dd897164b635d%2Fdatastores-v183-2.png?alt=media)

## Using Profiles to separate App Object data

Whenever the structure of an App Object is defined or modified in [AirData Builder](../../../studio/studio/builder-bar/airdata-builder), the designated object structure is saved across all relevant Datastores. App Object instances will be saved to separate Datastores depending on the profile being used to send information to AirData.

To demonstrate this, let's create two different sets of towing services for an app. One set will be mock data used in the Development environment for testing, and one set will be the data shown to the user in Production.

Go to AirData Builder. Select the **Production** profile from the Profile Selection menu at the top of the Studio. This profile is pre-configured to point to the **Production** Datastore.

> 🚧 Be mindful of the profile selected in the Profile Selection menu when testing and publishing your application, as it will directly impact the Datastore that the application will reference when querying AirData.

Create a new AirData App Object and name it "TowingCompanies". Give it the properties `name` (type: `text`) and `phone` (type: `phone`). Enter two to three records of real towing companies, then Save your application. A modal will appear indicating the 'TowingCompanies' App Object will be created in the Production Datastore. Click **Continue and Save**. This will serve as the **Production** data.

![](https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-31ba312b331c1a4d97ca010a5f7d50c1e48e0987%2Fdatastores-v183-3.png?alt=media)

Once you've established your **Production** data, change the profile in the Profile Selection menu to the **Development** Profile. Note that you still have access to the structure of the "TowingCompanies" App Object, but the table in the Stage is empty. Enter two or three new records of towing companies to represent test data. Click **Save**. A similar modal will appear to indicate the "TowingCompanies" App Object will be created in the **Development** Datastore. This will serve as testing data for the **Production** environment.

Switching between profiles will switch the data available when the Towing Provider database is queried.

![](https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-01fb9b612c234f682459bf3c96d9a661ad020cf9%2Fdatastores-v183-4?alt=media).gif)

## Referencing the same App Object Database in multiple apps

As long as two separate applications are referencing the same Datastore, it is possible for both apps to query the same AirData table, including not just the structure of the App Object but the stored information as well.

Once an App Object has been created in one app, the same App Object can be imported into another. To import an App Object, go AirData Builder, click on the '+' icon next to App Objects, and select **Import Object**.&#x20;

![](https://3333962744-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbnBffrSN2FHLC5cM89AM%2Fuploads%2Fgit-blob-86dfc16e3a69346dc3370f0fb936a5805bd56438%2Fdatastores-v183-5.png?alt=media)

A modal will pop up with all of the App Objects in the Organization that can be imported. Find the App Object you want to import and click on the **Import** button to import it to the application. Then save your application and refresh the Studio.

Multiple apps will now have access to the same App Object Database. Changes made to the App Object by one application will be reflected in all of the others.
