Documentation

Welcome to Retool! We're a fast way to build custom internal software.

You'll find the 5 minute demo, quickstart guide, and documentation for each of our connectors and components here. If you've got any questions -- chat with us on the bottom right!

Get Started    Guides

MongoDB Integration

Connecting MongoDB

MongoDB Driver Version

Retool currently uses MongoDB's 3.4 driver - so your connection strings should be using the mongodb:// protocol, not the mongodb+srv protocol.

Retool supports specifying your MongoDB's credential via connection string as well as normal host, username, password, etc. combination.

If you are using the cloud version of Retool, make sure to whitelist our IP Address 52.175.251.223.

MongoDB Queries

Basic Queries

You can now write MongoDB queries from Retool's editor interface. You first select which collection to edit, the method to query your MongoDB database with, and depending on which method, you can configure the query.

Below is a simple example of querying a MongoDB database for companies where name = 'Uber'

We don't support MongoDB's classic syntax

Instead we support MongoDB's Extended JSON syntax. For more information see https://docs.mongodb.com/manual/reference/mongodb-extended-json/

Here's an example of using MongoDB's Extended JSON Syntax to query based on an Objectid

See below for some simple equivalencies from the normal MongoDB syntax and the Extended JSON Syntax

// Object Ids
{ _id: ObjectId('5b3ddc6dd2ab742125322cf3') }
{ _id: { $oid: '5b3ddc6dd2ab742125322cf3' } }

// Dates: 
{ createdAt: new Date('2018-08-31T05:26:05+00:00') }
{ createdAt: { $date: '2018-08-31T05:26:05+00:00'} }

Dynamic Queries

Just like any other datasource in Retool, you can also refer to dynamic variables inside your MongoDB Queries. Here's an example of searching a MongoDB database based on a value of a textinput:

MongoDB Integration


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.