惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CERT Recently Published Vulnerability Notes
U
Unit 42
T
The Blog of Author Tim Ferriss
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Securelist
L
Lohrmann on Cybersecurity
Blog — PlanetScale
Blog — PlanetScale
Recorded Future
Recorded Future
D
DataBreaches.Net
Spread Privacy
Spread Privacy
T
Threat Research - Cisco Blogs
I
Intezer
P
Palo Alto Networks Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
I
InfoQ
宝玉的分享
宝玉的分享
Security Latest
Security Latest
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threatpost
Cisco Talos Blog
Cisco Talos Blog
P
Proofpoint News Feed
博客园 - 司徒正美
H
Hacker News: Front Page
Y
Y Combinator Blog
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
NISL@THU
NISL@THU
月光博客
月光博客
有赞技术团队
有赞技术团队
Cloudbric
Cloudbric
酷 壳 – CoolShell
酷 壳 – CoolShell
G
Google Developers Blog
A
Arctic Wolf
博客园 - 【当耐特】
W
WeLiveSecurity
V
Visual Studio Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
V
V2EX
C
Cyber Attacks, Cyber Crime and Cyber Security
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog

Supabase Blog

AI Agents Know About Supabase. They Don't Always Use It Right. Custom OIDC Providers for Supabase Auth 100,000 GitHub stars Supabase docs over SSH Navigating Regional Network Blocks Supabase Joins the Stripe Projects Developer Preview Log Drains: Now available on Pro Supabase Storage: major performance, security, and reliability updates Supabase incident on February 12, 2026 Hydra joins Supabase X / Twitter OAuth 2.0 is now available for Supabase Auth BKND joins Supabase Supabase is now an official Claude connector Supabase PrivateLink is now available Introducing: Postgres Best Practices When to use Read Replicas vs. bigger compute Introducing TRAE SOLO integration with Supabase Supabase Security Retro: 2025 Sync Stripe Data to Your Supabase Database in One Click Building ChatGPT Apps with Supabase Edge Functions and mcp-use Own Your Observability: Supabase Metrics API Introducing iceberg-js: A JavaScript Client for Apache Iceberg Introducing Supabase for Platforms Adding Async Streaming to Postgres Foreign Data Wrappers Build "Sign in with Your App" using Supabase Auth Introducing Seven New Email Templates for Supabase Auth The new Supabase power for Kiro Introducing Supabase ETL Introducing Analytics Buckets Introducing Vector Buckets Snap, Inc. Launches Snap Cloud, Powered by Supabase Triplit joins Supabase Supabase Series E 1000 Y Combinator Founders Choose Supabase gm 👋 web3, welcome aboard to Sign in with Web3 (Solana, Ethereum) Announcing the Supabase Remote MCP Server Enterprise speed, enterprise standards with Bolt Cloud + Supabase PostgREST 13 Lovable Cloud + Supabase: The Default Platform for AI Builders Processing large jobs with Edge Functions, Cron, and Queues Defense in Depth for MCP Servers OrioleDB Patent: now freely available to the Postgres community Supabase Launch Week 15 Hackathon Winner Announcement The Vibe Coder's Guide to Supabase Environments Testing for Vibe Coders: From Zero to Production Confidence The Vibe Coding Master Checklist Vibe Coding: Best Practices for Prompting Supabase Auth: Build vs. Buy Top 10 Launches of Launch Week 15 Supabase Launch Week 15 Hackathon Storage: 10x Larger Uploads, 3x Cheaper Cached Egress, and 2x Egress Quota Persistent Storage and 97% Faster Cold Starts for Edge Functions Algolia Connector for Supabase New Observability Features in Supabase Improved Security Controls and A New Home for Security Introducing Branching 2.0 Stripe-To-Postgres Sync Engine as standalone Library Supabase Analytics Buckets with Iceberg Support Create a Supabase backend using Figma Make Introducing JWT Signing Keys Supabase UI: Platform Kit Build a Personalized AI Assistant with Postgres Announcing Multigres: Vitess for Postgres Building on open table formats Open Data Standards: Postgres, OTel, and Iceberg Simplifying back-end complexity with Supabase Data APIs PostgreSQL Event Triggers without superuser access Top 10 Launches of Launch Week 14 Supabase MCP Server Data API Routes to Nearest Read Replica Declarative Schemas for Simpler Database Management Realtime: Broadcast from Database Keeping Tabs on What's New in Supabase Studio Edge Functions: Deploy from the Dashboard + Deno 2.1 Automatic Embeddings in Postgres Introducing the Supabase UI Library Supabase Auth: Bring Your Own Clerk Postgres Language Server: Initial Release Migrating from Fauna to Supabase Dedicated Poolers Postgres as a Graph Database: (Ab)using pgRouting AI Hackathon at Y Combinator Calendars in Postgres using Foreign Data Wrappers Supabase Launch Week 13 Hackathon Winners How to Hack the Base! Running Durable Workflows in Postgres using DBOS database.build v2: Bring-your-own-LLM Restore to a New Project Hack the Base! with Supabase Top 10 Launches of Launch Week 13 Supabase Queues High Performance Disk Supabase Cron Supabase CLI v2: Config as Code Supabase Edge Functions: Introducing Background Tasks, Ephemeral Storage, and WebSockets Supabase AI Assistant v2 OrioleDB Public Alpha Executing Dynamic JavaScript Code on Supabase with Edge Functions ClickHouse Partnership, improved Postgres Replication, and Disk Management Live Share: Connect to in-browser PGlite with any Postgres client
Migrating from the MongoDB Data API to Supabase
Prashant Sridharan · 2025-03-20 · via Supabase Blog

Migrating from the MongoDB Data API to Supabase

MongoDB announced that their Data API and HTTPS Endpoints will reach end-of-life by September 30, 2025. This has left many engineering teams evaluating alternatives. Supabase includes built-in support for REST APIs (via PostgREST), mirroring the core functionality previously provided by MongoDB's Data API.

MongoDB's Data API allowed developers to interact with their Atlas databases through straightforward RESTful endpoints, simplifying integration across frontend, backend, and serverless applications. With its removal, developers must pivot to alternative methods such as native MongoDB drivers combined with backend frameworks (Express, SpringBoot, FastAPI), or third-party solutions like RESTHeart, Hasura, or Neurelo.

This shift requires substantial refactoring for teams that rely on the simplified REST interface.

Supabase is an open-source MongoDB alternative and offers:

  • A managed Postgres database, eliminating vendor lock-in.
  • Built-in REST API via open-source PostgREST, directly analogous to MongoDB's Data API.
  • Real-time capabilities, authentication, file storage, and serverless functions—all tightly integrated.

Most notably, Supabase automatically generates a RESTful API from your database schema, powered by PostgREST, itself a stable open-source project with a strong community. This feature accelerates development by eliminating boilerplate code for basic CRUD operations. Supabase provides a near drop-in replacement for MongoDB’s Data API. The Supabase Data API also supports GraphQL and a host of mobile and web application frameworks.

In the end, you can focus on migrating your data, expose your data using Supabase’s Data API, and seamlessly integrate with your client applications.

To migrate to Supabase, you will need to:

  1. Export your MongoDB data
  2. Import JSON data into Supabase
  3. Normalize the data using SQL
  4. Transition your existing MongoDB Data API calls to Supabase PostgREST
  5. Add more Supabase features to round out your app

Step 1: Export your MongoDB data#

Export MongoDB documents using mongoexport:


_10

mongoexport --uri="mongodb+srv://<username>:<password>@cluster.mongodb.net/<dbname>" \

_10

--collection=users \

_10

--jsonArray \

_10

--out=users.json


Step 2: Import JSON data into Supabase#

Create a table in Supabase with a JSONB column to store raw Mongo documents:


_10

create table mongo_users_raw (

_10

id uuid primary key default gen_random_uuid(),

_10

data jsonb not null

_10

);


Then, ingest the exported JSON data into this Supabase table using this custom script:


_31

import { createClient } from '@supabase/supabase-js'

_31

import fs from 'fs'

_31

_31

const supabaseUrl = 'YOUR_SUPABASE_URL'

_31

const supabaseKey = 'YOUR_SUPABASE_API_KEY'

_31

const tableName = 'YOUR_TABLE_NAME'

_31

const jsonFilePath = './filename.json'

_31

_31

const supabase = createClient(supabaseUrl, supabaseKey)

_31

_31

async function loadDocumentsToSupabase() {

_31

try {

_31

// Read JSON file

_31

const rawData = fs.readFileSync(jsonFilePath)

_31

const dataArray = JSON.parse(rawData).map((data) => ({ data }))

_31

_31

// Insert data into Supabase

_31

const { error } = await supabase.from(tableName).insert(dataArray)

_31

_31

if (error) {

_31

console.error('Error inserting data:', error)

_31

return

_31

}

_31

_31

console.log(`Successfully inserted ${dataArray.length} records into ${tableName}`)

_31

} catch (error) {

_31

console.error('Error in process:', error)

_31

}

_31

}

_31

_31

loadDocumentsToSupabase()


Step 3: Normalize the data using SQL#

Once your data is imported as JSONB, leverage PostgreSQL’s powerful JSON functions to incrementally normalize and populate relational tables:


_16

-- Example to normalize user data

_16

INSERT INTO users (name, email)

_16

SELECT

_16

data->>'name' as name,

_16

data->>'email' as email

_16

FROM mongo_users_raw;

_16

_16

-- Example to normalize orders into a separate table

_16

INSERT INTO orders (user_id, product, quantity)

_16

SELECT

_16

u.id,

_16

orders->>'product',

_16

(orders.value->>'quantity')::INTEGER

_16

FROM mongo_users_raw m

_16

JOIN users u ON (m.data->>'name') = u.name,

_16

LATERAL jsonb_array_elements(m.data->'orders') AS order_data


Step 4: Transition API calls to Supabase PostgREST#

Once your data has been structured into tables, Supabase automatically generates REST APIs for each table via PostgREST, allowing effortless querying from your application.

For example, if you have a users table, querying user information using Supabase’s JavaScript library would look like this:


_20

import { createClient } from '@supabase/supabase-js'

_20

_20

const supabase = createClient('https://<your-project>.supabase.co', '<your-api-key>')

_20

_20

// Fetch user named John along with their orders

_20

const { data, error } = await supabase

_20

.from('users')

_20

.select(

_20

`

_20

id, name,

_20

orders (product, quantity)

_20

`

_20

)

_20

.eq('name', 'John')

_20

_20

if (error) {

_20

console.error(error)

_20

} else {

_20

console.log(data)

_20

}


Using the automatically generated Supabase REST APIs offers a clear migration path from MongoDB’s deprecated Data API.

Step 5: Add more Supabase features#

Once your data is migrated, you can start to use Supabase to its fullest:

  • Authentication. Let your users login with email, Google, Apple, GitHub, and more. Secure and trusted.
  • Role-Based Access Control (RBAC). Secure your data properly.
  • Storage. Affordable and fast, for all the videos and images you need in your app.
  • Edge Functions. Custom backend logic when you want to dive into code.
  • Realtime. Build immersive multi-player, collaborative experiences.
  • AI Ready. When you’re ready to explore vectors and the power of AI, Supabase is there with industry-standard tools to guide you.
  • Foreign Data Wrappers (FDW). Pull data from Google Sheets, Airtable, MySQL, and more, as if they were part of Supabase natively.
  • Instant and secure deployment. No need to set up servers, manage DevOps, or tweak security settings.
  • Schema flexibility: PostgreSQL schemas are less flexible than MongoDB; careful upfront design mitigates this.
  • Complexity in migration: Document structures require transformation scripts.
  • Query patterns: Analyze existing MongoDB queries to optimize relational joins.
  • Add indexes: Use the Index Advisor in the Supabase Dashboard to further optimize your tables.

Supabase is an ideal replacement for MongoDB, especially considering the Data API deprecation. Supabase is built on Postgres, one of the world’s most powerful and scalable databases. In addition, Supabase’s Data API directly parallels MongoDB's Data API, offering a simplified transition path.

This blog post provides further detail on how to transition from MongoDB. If you’re encountering difficulty, feel free to reach out to us. We’d be happy to help.

With careful planning and methodical execution, engineering teams can navigate this migration confidently, leveraging Supabase as a trusted, long-term solution.