Convert your MongoDB database into RESTful API without any code.


MongoDB is a document-oriented NoSQL database used for high volume data storage. Instead of using tables and rows as in the traditional relational databases, MongoDB makes use of collections and documents. Documents consist of key-value pairs which are the basic unit of data in MongoDB.

Getting Started

After you create an account and log in to the dashboard, choose MongoDB service on the collections page. To make MongoDB API you need to provide your database credentials on the MongoDB creation form.

  • Connection String
  • Database
Attention needed
Make sure you already enable remote access to your MongoDB server and configured to accept connections from SlashAPI's IP Addresses.

API Endpoints

Table name act as API endpoints

The name of your table will be used as the API endpoint name. So, if database has a table called "users", the API URL will look like this:<team>/mongodb/<identifier>/users

GET Records

To Get records from your MongoDB table, you just need to put your table name to the base API URL.


For example, if you want to get records from your users table, your API endpoint will look like this:


In the GET records endpoint, you can use some of query parameters to allow you modify the fetched data. e.g sort by column, modify limit and pagination, etc.


The reserved word is order_by. order_by is used to sort the fetched data in either ascending or descending according to one or more columns.


By default the order_by sorts the data in ascending order. You can use the keyword desc after the column name to sort the data in descending order.


You can also sort the fetched data using multiple columns, Multiple order uses a comma separated.


Limit and Pagination

SlashApi provides a page and per_page parameter that is used to paginate your data. SlashApi automatically takes care of setting the query's limit and offset based on the current page being viewed by the user. The current page is detected by the value of the page query string argument on the HTTP request.

To set the limit query, you need to set the per_page value in your query parameter to modify the number of items you would like to displayed. SlashApi set the default value for per_page option to 10. So, if you are not provide the per_page option in your API request, SlashApi will limit the number of items to 10.


Database queries are created as valid JSON documents. A query object consists of fields and operators that make up a complete query.

Query example:


Multiple parameters;

Filter Embedded Documents

To specify a query condition on fields in an embedded/nested document, use dot notation

Logic Operators
Abbr Description Example
$ne Not equal {"field":{"$ne":value}}
$like Like operator {"field":{"$like":value}}
$in Match any value in array {"field":{"$in":[value1,value2,...]}}
$nin Not match any value in array {"field":{"$nin":[value1,value2,...]}}
$or Logical operator {"$or":[{"field":"value"},{"field":"Another Value"}]}
$and Logical operator {"$and":[{"field":"value"},{"another_field":"value"}]}
Conditional Operators
Abbr Description Example
$gt Greater than {"field":{"$gt":value}}
$gte Greater than equal {"field":{"$gte":value}}
$lt Less than {"field":{"$lt":value}}
$lte Less than equal {"field":{"$lte":value}}
$between Matches field value between two numeric values {"field":{"$between":[1,5]}}
Date operator

Querying based on dates are done using the our predefined operator combined with date strings.

Operator Description
$date Compare a column's value against a date
$day Compare a column's value against a specific day
$month Compare a column's value against a specific month
$year Compare a column's value against a specific year

Query Example:

// Query equal date

// Query between two dates

// Compare a column's value against a specific day:

// Compare a column's value against a specific month:

// Compare a column's value against a specific year:

Selecting column

You may not always want to select all columns from a database table. Using the select query parameter, you can specify a custom "select" clause for the query:


Get Specific Record

To get specific record of your table, you can specify the primary key as the identifier.


For example, if you want to get the records for posts table with _id = 610ab5f1d482594c47689b0b, you can use the URL like this:


Create Record

SlashApi also provides an endpoint that may be used to insert records into your database table. This endpoint using the POST method and accepts an array of column names and values. Missing properties will be set to the default values when applicable.


Request Body

    "data": {
        "title": "Some title",
        "content": "Long text",
        "embed": {

Update Record

To update a row in a table, use the PATCH verb and specify the primary key as the identifier in your API URL path.


Request Body

    "data": {
        "title": "Updated title",
        "content": "Updated text",
        "embed": {

Delete Record

To Delete a row in a table, use the DELETE verb and specify the primary key as the identifier in your API URL path.