All Collections
Flamelink Documentation
Flamelink Extended Data Manager (EDM)
Flamelink Extended Data Manager (EDM)

How to create and link schema's to existing Cloud Firestore Data

Support avatar
Written by Support
Updated over a week ago

Overview

The Extended Data Manager allows you to map your existing Cloud Firestore data to Flamelink. This allows you to supercharge the management of your data without needing to port your existing data to the pre-defined Flamelink data structures.

One of the benefits of using Flamelink with your existing data is that you get to use all the following features out of the box once it is mapped to a schema:

  • Multiple Environments

  • Multiple Languages

  • Webhooks

  • Permissions

  • Schemas & Validation

  • Relational Data Management

  • Media Integration

  • Content Workflows

  • Backup & Restore

The EDM feature is available as an add-on for our Firestarter, Bonfire & Inferno plans, and is included in the feature-set for Wildfire.
Read more about upgrading and add-ons.


How to setup schemas using the EDM feature

Now that we know the benefits and we have enabled the EDM feature for our project, let's go ahead and map our existing data to a schema.

For this example, let's imagine we have an online store with products that are linked to categories.

The products & categories collections below have not been linked to a Flamelink schema yet. You will notice that the product highlighted has a reference to the categories collection and some other data that describes the product.

Step 1 - Creating a schema for our categories

Our categories collection has one document with the following fields

  • enabled (boolean)

  • name (string)

Below is an example of the categories schema mapped in Flamelink

Navigate to "Schemas" from the menu and select "New Schema".

You will notice a Custom Path field, use this field to specify the path to your collection or document you want the schema to reference.

Select the "Add Fields" tab and select the fields you need for your schema.
The Field Key value should match the field key value in Firestore.


For this example, we have added a Text field with the Field Key value of name

and a Switch field with the Field Key value of enabled

Upon saving you will notice that some metadata will be added to your documents stored in Firestore.


Step 2 - Creating a schema for products

Our products collection has one document with the following fields

  • sku (string)

  • title (string)

  • price (number)

  • sizes (array of string)

  • categories (array of references)

Similar to how we have set up our categories schema, you will notice a Custom Path field, use this field to specify the path to your collection or document you want the schema to reference.

Since we have already covered the basic fields, let's zoom in on the sizes and categories fields.

For the sizes field, we use the "Select" field and provide it with some options as shown below.

For the categories field, we use the Tree (Relational) field and set the Relational Data value to the Categories schema.

Once you have created your schemas, you can navigate to Content from the main menu to view your newly created schemas and their entries.


Step 3 - Setting up a test environment & workflow

Skip to Step 4 if you intend to only use a single environment.

Let's set up a new environment to first edit some of our content before publishing it.

Select "Settings" from the navigation bar followed by "Environments & Languages" from the sub-menu.

Once you have selected the "+" (Add Environment) button fill out the form and be sure to populate your environment with the data from your Production environment.

Now let's set up a Linked Environment Workflow

Select "Settings" from the navigation bar followed by "Workflows" from the sub-menu, then select "Add Workflow"

Note: Advanced Workflows are only available for certain paid subscriptions.

Add both the Test & Production environment with some relevant statuses and select "Next"

Select the relevant schemas you want to connect to your new workflow and click "Save"


Step 4 - Working with the data

If you did not skip Step 3 - go ahead and select your "Test" environment from the environment selector.

Now select "Content" from the main navigation to view your entries.
As you can see we have 1 entry for each schema.

Products

Categories

Our entries have been successfully mapped to a Flamelink schema and are now ready for editing or adding additional entries.


Step 5 - Publishing our changes to production

Now that we have added some more entries in our Test environment, let's go ahead and promote them to our Production environment.

First, we will promote all of our referenced entries - in this case, it would be our Categories.


Select the entries ready for promotion, then select "Change Status" from the bulk options and "Confirm" your choice.

Select "Publish" as the status and choose the "Promote to" status that you would like.
Once done, select "Save & Promote"

We will do the same for the Products schema

Once all our entries have been successfully promoted to our Production environment, they are available under the content section after switching to the environment.

We now have a total of 6 product entries in our Firestore database.

  • 3 entries for our Test environment

  • 3 entries for our Production environment

Entries can easily be queried using a simple filter from any of the Firebase SDK's

Example: 

firestore.collection('products')
.where("_fl_meta_.env", "==", "production")


Troubleshooting

  • I have trouble retrieving the data for my schema and are presented with errors
    Please ensure that your database rules allow read and write access for the relevant documents/collections. Flamelink adheres to the rules provided for your Cloud Firestore database.

  • I can't map a schema to my data because there is no option for my data type

    Please contact us with some details of your current data structure and the limitation you are facing. The more information you provide the better.

  • I can't map a parent document with a sub-collection

    Please see the notes below.

  • I do not see the option for a "Custom Path"
    The EDM feature is available as an add-on for our Firestarter, Bonfire & Inferno plans, and is included in the feature-set for Wildfire. Read more here on upgrading and add-ons.

PLEASE NOTE:

  • The EDM feature is only intended for Cloud Firestore

  • The EDM feature currently supports mapping to sub-collections directly but not yet as a sub-collection of a parent document. This enhancement is currently under development.

Did this answer your question?