MongoDB

Terra can store health data directly in your MongoDBarrow-up-right database, with full payloads stored inline (no external URLs to fetch).

Setup

You'll need a MongoDB instance reachable from Terra's servers. Terra supports both mongodb:// and mongodb+srv:// connection schemes.

circle-exclamation

Create a database user with read/write access to your target database. Enter the following in the Terra Dashboard when adding the MongoDB destination:

  • Host (e.g. cluster0.abc123.mongodb.net)

  • Database name

  • Username and password

  • Connection scheme (mongodb or mongodb+srv)

Data Structure

Terra creates collections automatically and adds indices on first write.

Collections

Collection
Contents
Document ID

user_events

Auth events (auth success, deauth, access revoked, etc.)

{user_id, event_time}

athlete

Athlete profile data

user_id

activity

Activity data

{user_id, start_time}

body

Body metrics

{user_id, start_time}

daily

Daily summary data

{user_id, start_time}

sleep

Sleep data

{user_id, start_time}

nutrition

Nutrition data

{user_id, start_time}

menstruation

Menstruation data

{user_id, start_time}

Indices

Terra creates the following indices automatically:

  • user_events and athlete: user.user_id (ascending), user.reference_id (ascending)

  • Data collections (activity, body, daily, sleep, nutrition, menstruation): metadata.start_time (descending), metadata.end_time (descending)

Document format

All documents include the full data payload inline — there are no external URLs to download. Each document includes a user object with the user's details.

Data event example:

Documents are upserted — if a document with the same ID already exists, it is replaced with the latest data.

Last updated

Was this helpful?