NEW

SurrealDB 4 is here, introducing SurrealDB Earth and SurrealDS!

Learn more

SurrealDB vs.
MongoDB

MongoDB. A document database with search, vectors and limited graph features in separate subsystems.
SurrealDB. A unified, transactional database for documents, graphs, vectors, full-text and time-series.
The difference. One transaction spans a document write, a graph edge, a vector and a full-text index.

01 |THE DIFFERENCE

Where MongoDB adds subsystems, SurrealDB runs natively

MongoDB added search, vector and limited graph features as separate systems. SurrealDB runs all of them in one engine, in one transaction.

02 |THE SAME QUERY

Similar documents, from one team, this quarter. A staged aggregation with a search stage and a lookup in MongoDB. One statement in SurrealQL.

MongoDB Atlas

1// Atlas: $vectorSearch first, then a $lookup, then the filter
2db.documents.aggregate([
3 { $vectorSearch: { index: "vec", path: "embedding", queryVector: q,
4 numCandidates: 100, limit: 10 } },
5 { $lookup: { from: "people", localField: "authorId",
6 foreignField: "_id", as: "author" } },
7 { $match: { "author.team": team, published: { $gt: since } } },
8 { $project: { title: 1, score: { $meta: "searchScore" } } }
9])

SurrealQL

1-- SurrealQL: the similarity and the path, together
2SELECT
3 title,
4 vector::similarity::cosine(embedding, $q) AS score
5FROM document
6WHERE embedding <|10|> $q
7 AND <-authored<-person->member_of->team CONTAINS $team
8 AND published > time::now() - 90d
9ORDER BY score DESC;

03 |HOW IT COMPARES

How SurrealDB and MongoDB differ

Richer models, temporal logic and AI retrieval push document stores with external subsystems to their composability limits. SurrealDB runs everything in one distributed engine.

Data and relationships

SurrealDB

MongoDB

Models
NativeNative support for document, relational, graph, key-value, time-series, vector, full-text search, and geospatial.
Document-firstDocument-first. Graph traversal support is limited. Relational semantics are not planner-driven.
Indexing
UnrestrictedIndexing across arrays, nested fields, vectors, and relationships without compound multikey restrictions.
RestrictedCompound indexes may include only one array field. Deeply nested or multi-array document models cannot be efficiently indexed.
Temporal capabilities
First-classTemporal querying is first-class. Time constraints participate directly in graph traversal.
NoneNo temporal graph querying. Time filters cannot participate directly in traversal semantics.
Consistency and queries
Transactional consistency
Every modelACID transactions across documents, relational joins, graph traversal, vector search, and full-text search.
LimitedACID transactions are limited, costly under contention, and do not extend to search, vectors, or graph traversal.
Query execution
One planSingle declarative query language with a unified execution plan. All retrieval primitives are co-planned.
StagedQueries split into multiple stages, with $search required first. No unified planner across document, search, vector, and graph operations.
Operations and cost
Architecture
One engineUnified, distributed multi-model engine. Query execution, indexing, storage, and transactions operate inside a single system.
SubsystemsDocument-first with secondary views, full-text search, and vectors requiring duplicated data and separate async pipelines.
Pricing
UsageUnified engine eliminates the need for separate search, vector, and graph systems. Costs scale linearly.
InfrastructureCosts increase with sharding, coordination overhead, Atlas dependency, and duplicated subsystems.

TRUSTED BY

Enterprise teams building on SurrealDB

MongoDB,answered

MongoDB is a document database that adds search, vector and limited graph features through separate subsystems. SurrealDB is one engine for documents, graphs, vectors, full-text, temporal and relational queries.

THE PLATFORM

Everything an application and its agents know. Five surfaces, one engine.

IN PRODUCTION

Trusted at scale. Samsung, Nvidia, Verizon, Tencent, and Walmart run on SurrealDB.

14,000+

Developers building on SurrealDB Cloud

4M+

Developers building on SurrealDB worldwide

FROM THE TEAMS

SurrealDB gives us a foundation where we can unify semantic search, knowledge graphs, and AI-driven decision making without stitching together multiple systems. Collapsing responsibility into SurrealDB has become our default engineering posture.
Justin Foley

VP of Engineering, Later

GET STARTED

Migrate from MongoDB. Documents, plus the graphs, vectors and SQL MongoDB leaves to other systems.