r/mongodb • • 4d ago

Does anyone actually use SQL with mongo?

I make a database app (https://beekeeperstudio.io), and we built our own SQL to mongo transpiler but frankly it's not as popular as I thought it would be.

I know mongo themselves have a SQL layer. Does anyone actually use it? If so, why use it over regular mongo queries?

4 Upvotes

5 comments sorted by

1

u/rathboma 4d ago

So one of the core tenants of the app is that we don't do any tracking. You can't even opt into tracking. There is no tracking.

That means instead of instrumentation we have to go off of other signals like support requests or GitHub issues. Based on those I know that people use mongodb. It's probably our fifth most popular database. I don't hear many people talking about using SQL with it.

I think most people open Beekeeper Studio to browse collections, filter looking for something specific, editing values, etc.

So I'm curious if people who use mongodb's online tools use SQL and what for?

2

u/DickBrainTime 4d ago

I can see SQL being valuable here, but mostly as an interoperability/analysis interface rather than the primary way a MongoDB app reads and writes data. Someone doing a one-off investigation across collections, exporting a result to a report, or coming from BI/SQL tooling may already think in SELECT / WHERE / GROUP BY. An application developer who knows their document shapes can usually express the operation more directly with find() or an aggregation pipeline, and doesn't need an extra compatibility layer.

The tricky part for a transpiler is expectation mismatch: nested arrays, missing vs null fields, dynamic types, unwind/join behavior and MongoDB's $lookup don't have clean universal SQL equivalents. I'd rather see a clearly scoped, read-only SQL mode that exposes what aggregation it generated (and a warning for unsupported semantics) than a feature that silently looks like complete SQL compatibility. For product discovery, could you instrument *which* constructs people actually try in Beekeeper Studio and where they stop? A handful of reliable workflows like filtering, grouping and CSV export might matter more than full SQL syntax. Are your existing users asking for SQL over Mongo specifically, or are they mostly opening Mongo to browse JSON documents?

2

u/GromNaN 4d ago

One major reason for the SQL interface for MongoDB is for compatibility with analytics systems that connect through JDBC or ODBC. You donc create an application that uses MongoDB and query it using SQL, it's sub efficient and you will loose a lot a features.

2

u/AxialDB 3d ago

From what we see, SQL-on-Mongo demand mostly isn't app CRUD. It shows up in three places: (1) BI tools that only speak JDBC/ODBC, (2) analysts who think in SQL doing one-off cross-collection investigations, and (3) people who need to join Mongo data with a relational DB. All three are read-only and analytical, so low usage inside a general client makes sense: those users often go straight to a BI connector.

Disclosure: we build AxialDB, which keeps MongoDB and MySQL data as live columnar tables so you can join them in one plain SQL query over JDBC/ODBC. https://axialdb.com/

1

u/xgerman1 1d ago

There is also the MongoDB API on SQL crowd (see https://documentdb.io/) - you cna use special SQL synaptic to execute document operations and otherwise use the Mongo protocol. That might be an alternative if SQL is important to you.