Skip to main content
Hyperterse supports MongoDB as a document database connector. Statements are passed as native MongoDB database commands — the same syntax used by db.runCommand() in the MongoDB shell. This gives you access to any operation MongoDB supports: find, aggregate, insert, update, delete, and administrative commands.
Hyperterse connects to your existing database. It does not create or manage databases — you provide a running MongoDB instance (self-hosted or MongoDB Atlas) and a connection string.

Adapter configuration

Create an adapter file in app/adapters/:
app/adapters/mongo-db.terse
The connection string uses the standard MongoDB URI format:
mongodb://user:password@host:27017/database

Connection options

string
Maximum number of connections in the pool.
string
Minimum number of idle connections maintained in the pool.
string
Timeout in milliseconds for establishing a new connection.
string
Timeout in milliseconds for selecting a server from a replica set or sharded cluster.

Verify the connection

Start the server and confirm the adapter connects:
A successful connection produces:
If the connection fails, the server exits immediately with a diagnostic message.

Usage

MongoDB tool statements are JSON objects with two required fields: database and command. The command field takes a raw MongoDB database command.
app/tools/find-users/config.terse
The command name (e.g., "find", "insert", "aggregate") must be the first key inside the command object. MongoDB rejects commands where the operation name is not the first field.

Statement format

Aggregation example

app/tools/sales-summary/config.terse

ObjectId handling

For queries involving ObjectId fields, pass them using the extended JSON format:

Troubleshooting

Connection refused

Verify MongoDB is running and reachable:
Check firewall rules for remote instances and ensure the Atlas IP allowlist includes your server’s address.

Authentication failed

Ensure the connection string contains the correct username and password. URL-encode special characters in passwords (e.g., @ becomes %40).

TLS / Atlas

For MongoDB Atlas, always use the mongodb+srv:// URI provided by Atlas. The driver handles TLS and server discovery automatically. For custom certificates, configure TLS options in the connection string.

Invalid statement JSON

The statement field must be valid JSON after {{ inputs.* }} substitution. Ensure all placeholders resolve to properly quoted JSON values. The command object must have the operation name as its first key.