Skip to main content

Built-In database

Squid's applications are equipped with a built-in NoSql database integration with ID built_in_db. This integration is used by default when no integration ID is provided.

This database is available for you to quick start using Squid without connecting an external database and can be used alongside other integrations or as a standalone database depending on your use case and requirements.

Since the database is NoSql, any collection you access will be created automatically if it does not exist.

Accessing the database

To access the database, simply use the Squid Client SDK to query or mutate the database.

const usersCollection = squid.collection<User>('users');
const users = await usersCollection.query().snapshot();
await usersCollection.doc('new_user_id').insert({ name: 'John Doe' });

Note that there was no need to specify the integration ID when accessing the database since this is the default integration.

Defining the schema

Like any other integration, you have the ability to define the schema of the database. When you define a schema, Squid will enforce the schema on all the data that is inserted or updated unless it is mutated by the backend - there you can bypass security rules and schema validation.

Built-In schema

Indexes

Squid's database has index support, which enhances query performance. When you filter data, Squid tracks your queries and generates indexes accordingly.

At present, you cannot manage this behavior via the Squid Cloud Console. However, we may offer more detailed management options in the future.

Datatype mapping

All Squid datatypes are natively supported by the built-in database.

To learn how to work with data in Squid, view the Client SDK documentation.