MongoDB Explorer
Explore a MongoDB document or collection sample and infer its field schema and types.
Your MongoDB documents are parsed and analyzed locally in your browser; nothing you paste leaves your device or is uploaded to a server.
Need TypeScript types from this sample? Try JSON to TypeScript.
About MongoDB Explorer
This mongodb schema explorer takes a single MongoDB document or an array of documents as JSON and infers the underlying field schema for you. Paste a sample from Compass, mongosh, or an application log and it walks every document, builds a flat list of field paths (including nested objects and array-of-object elements), labels each with a loose BSON-ish type such as int, double, string, bool, object, array, or null, and shows how many documents in the sample contain each field. It is built for backend developers, data engineers, and QA testers who need to understand a collection's shape, spot optional or inconsistent fields, and document a schema quickly. Everything runs locally in your browser, so the documents you paste never leave your device and nothing is uploaded to a server.
Features
- Accepts a single document or an array of documents as JSON
- Infers a flat list of field paths sorted alphabetically
- Labels each field with a BSON-ish type: int, double, string, bool, object, array, or null
- Descends into nested objects and into the first element of object arrays (path[].field)
- Counts how many documents contain each field so you can spot optional fields
- Merges multiple types per field when documents disagree (e.g. int | null)
- Shows a document and field count summary at the top of the schema
- Runs live as you paste and works entirely offline in your browser
How to use the MongoDB Explorer
- Paste a MongoDB document or an array of documents as JSON into the input box.
- Read the inferred schema table on the right, with field paths, types, and coverage.
- Check the present/total count beside each field to find optional or sparse fields.
- Expand nested paths and array fields to see deep structure.
- Copy or download the normalized JSON to share the sample.
Example
Input
[
{ "_id": 1, "name": "Ada", "age": 36, "roles": ["admin"] },
{ "_id": 2, "name": "Linus", "active": true, "address": { "city": "Helsinki" } }
]
Output
_id int 2/2
active bool 1/2
address object 1/2
address.city string 1/2
age int 1/2
name string 2/2
roles array 1/2
Two documents inferred into field paths, types, and per-field coverage.
Common errors & troubleshooting
- The input is rejected with a JSON parse error. — Make sure the sample is valid JSON: double-quoted keys and strings, no trailing commas, and no mongosh helpers like ObjectId() or ISODate().
- You pasted ObjectId(...), ISODate(...), or NumberLong(...) straight from the shell. — Replace these extended-JSON constructors with plain JSON values (e.g. a quoted string) before pasting, since the explorer parses standard JSON.
- You get a message asking for a document or an array of documents. — Provide an object or an array of objects. Bare arrays of scalars or a single primitive value have no fields to infer.
- An array of objects only shows fields from the first element. — This is expected: array-of-object schemas are inferred from the first element (path[]). Reorder the sample so a representative object comes first.
- A field shows two types like int | double or string | null. — That means documents in your sample disagree on that field's type; it is informational, not an error.
Frequently asked questions
- What is the MongoDB schema explorer?
- It is an in-browser tool that takes a MongoDB document or a sample array of documents as JSON and infers the schema: every field path, a BSON-ish type for each, and how many documents in the sample contain that field.
- How does it infer field types?
- It inspects each value and assigns a loose BSON-ish label: integers become int, non-integers become double, plus string, bool, object, array, and null. When documents disagree, the field shows every type it saw joined with a pipe.
- Does it handle nested objects and arrays?
- Yes. Nested objects produce dotted paths like address.city, and arrays of objects are explored through their first element using a path[].field notation.
- What does the count next to each field mean?
- It is the field's coverage, shown as present/total, meaning how many documents in your pasted sample include that field. A value below the total flags an optional or sparse field.
- Can I paste extended JSON from mongosh or Compass?
- Paste standard JSON. Replace constructors such as ObjectId(), ISODate(), and NumberLong() with plain values first, otherwise JSON parsing will fail.
- Is my data safe when I use this MongoDB schema explorer?
- Yes. The explorer runs entirely in your browser, so the documents you paste never leave your device and nothing is uploaded to a server.
Related tools
All ArrayKit tools