Emulate Firestore

The field firestore gives you an option to have a separate Firestore database from your production Firestore database. This separate Firestore is an emulated Firestore database that lives in your cloud environment for the duration of your session.

The firestore field expects an array of collections. You have two options on how to fill an emulated Firestore database:

Specify your emulated Firestore data directly with JSON


                            
firestore:

                            
- collection: workspaces

                            
docs:

                            
- id: ws-id-1

                            
data: '{"userId": "user-id-1"}'

                            
- id: ws-id-2

                            
data: '{"userId": "user-id-2"}'

                          

Copy data from your production Firestore database


                            
firestore:

                            
- collection: workspaces

                            
docs:

                            
- getFromProd: [workspace-id-1, workspace-id-2]

                            
# This option tells Foundry to take first 2 documents from collection 'workspaces'

                            
# in your production Firestore database

                            
- getFromProd: 2

                          

You can combine both the direct approach and getFromProd approach

To create a nested collection specify a full collection's path:


                            
firestore:

                            
- collection: my/nested/collection

                            
docs: ...