Docs · DBCatz

MongoDB and Elasticsearch

How DBCatz shows MongoDB collections and Elasticsearch indexes — documents in a grid, filters, structure, the mongosh methods it runs and console requests.

MongoDB and Elasticsearch hold documents, not rows — but in DBCatz they open in the same Data · Structure · Query · Logs tabs as a SQL table. This page covers what is different. The grid itself is on Data and JSON.

Documents in a grid

  • Each top-level field becomes a column, in the order the fields first appear.
  • _id is the primary key, so documents can be edited, inserted and deleted like rows.
  • Nested objects and arrays get the { } button and the JSON editor.
  • When you type a value, DBCatz stores it as JSON if it parses as an object, an array, a number or a boolean — and as a string otherwise.

MongoDB

Connecting

  • Use mongodb:// or mongodb+srv:// URLs, or tick Atlas / mongodb+srv (the host is an SRV record) in the form. TCP/IP, Socket (on a Mac), SSH and Vault all work — see Connections.
  • The Database field is also the auth database. In a URL, authSource sets it.
  • The system databases admin, config and local are grouped under System, and system.* collections under System tables.

Filtering a collection

The Filter field takes a filter document in relaxed JSON: { status: 'active' }, { age: { $gt: 30 } }. The row count is countDocuments with your filter, or estimatedDocumentCount without one.

Structure

Fields (from a sample of documents) lists the fields found in the first 100 documents, since a collection has no fixed columns. Indexes are listed and can be created and dropped like SQL indexes — see Indexes. Views have no indexes.

Collections and databases

  • Create table creates a collection — just a name: A collection has no fixed columns.
  • Rename Table… renames the collection; Duplicate Collection… copies it with its indexes, and its documents unless you untick Copy the documents too.
  • To add a field, insert a document and use + Field in the form — MongoDB has no fixed columns: each document carries its own fields.
  • A database exists once it has a collection, so create the first collection right after creating a database.

mongosh in the Query tab

The Query tab speaks mongosh. Each statement starts on a line with db. (or { for a raw command):

db.orders.find({ status: 'paid' }).sort({ createdAt: -1 }).limit(20)
db.orders.countDocuments({ status: 'paid' })
{ ping: 1 }

The methods DBCatz runs:

Kind Methods
Read find (with .sort, .limit, .skip …), findOne, aggregate, countDocuments, count, estimatedDocumentCount, distinct
Write insertOne, insertMany, updateOne, updateMany, replaceOne, deleteOne, deleteMany
Collection drop, createIndex, dropIndex, getIndexes / indexes
Command A raw command document, such as { ping: 1 }

The JSON is relaxed: unquoted keys, single quotes, trailing commas, ObjectId("…") and ISODate("…") all work.

mongosh is highlighted and has autocomplete: collections, methods, the collection’s fields, operators and aggregation stages — see Autocomplete.

What asks first on MongoDB

drop(), deleteMany({}) and updateMany({}) with an empty filter, and the drop, dropDatabase and dropIndexes commands, are destructive. An aggregate with $out or $merge is a write. See Production safety.

Elasticsearch

The cluster is the database

On Elasticsearch, the “database” is the cluster — there is no Create database. Each index is a table, and its documents are the rows. Dot indices (Elasticsearch’s own) are grouped under System tables.

Connecting

Use an http:// or https:// URL (https://user:pass@host:9200), or the form with TCP/IP, SSH or Vault — there is no socket. A self-signed certificate works once Verify the server certificate is off.

Filtering an index

The Filter field takes either a Lucene query string — title:shoes — or a JSON query, such as { match: { title: 'shoes' } }.

Structure and new indexes

Structure shows the index’s Mapping, with + Field to add a field of the type you choose. A field a new document brings is added by itself; a field’s type cannot change or be removed later — Duplicate Index… copies the index’s mappings and analysis settings (and its documents, unless you untick it), so you can change it there instead. Create table creates an index: the fields you add become its mapping; leave them empty for a dynamic mapping.

Requests in the Query tab

The Query tab takes console requests: a method and a path on one line, and an optional JSON body below.

GET /products/_search
{
  "query": { "match": { "title": "shoes" } }
}

Each request starts on a line with a method, so you can put several in one editor and run them together. Requests are highlighted and have autocomplete: index names and endpoints on the first line, query keys and the index’s fields in the body — see Autocomplete.

Every DELETE request, and _delete_by_query, is destructive — it asks first, and is refused on a Read-only connection.

Export

Exports scroll through all the documents, 500 at a time, so a large index exports in full. Formats are on Export, import and backup.

Importing documents

Both engines import CSV into a collection or index (made when missing) and JSON / NDJSON — see Import.

Last updated 2026-11-03