simple online nosql database database with REST API and MongoDB queries
  • Features
  • Docs
  • Blog
  • Templates
  • Pricing
  • Contact
  • Sign Up
  • Log In

Blog

 The latest news and articles about restdb.io  

Database templates!
Don't forget to visit our template catalog! It's the fastest way to get up and running with a restdb.io database. View templates »

If you got the numbers, RestDB will do the math

by Knut Martin Tornes
|
User|Howto|
  • Share on Facebook
  • Tweet
  • Add to Pocket
  • Share on LinkedIn
  • Send email
From spreadsheets you might be familiar with formulas and calculations. RestDB supports calculations (for example adding a field that includes price + VAT) and aggregation functions like sum, average, minimum, maximum and count. It's quite easy to set up.
Calculations

First, as always when changing the schema of your database, you must activate "Developer Mode" as shown.

Then, we click on the field that we want to be calculated. We enter our formula (using Handlebars template) like this: {{hour-price}}*{{hour-estimate}}. When the record is saved, the value of this field will be calculated.


We can now see that the value is calculated according to the expression. Also note that it is read only.


Aggregation functions

Now that we've finished adding a calculated field, we want to add a sum to our total. If you are a developer or admin of a database, you will find a small   symbol in the left corner of the record list.

Clicking this, enables the aggregation functions on number columns. We'll add a function to the "total-value" calculated field.
We'll just select the "Sum" function.

We can now see the sum of the "total-value" field.  

Aggregation of child record fields
RestDB can also show aggregations of child fields. For example if we have an Activity collection with Hours children, you can show the sum of the Hours on the Activity. We'll come back in another article with a more detailed example.

We have just shown you how to add calculated fields and aggregations to RestDB collections. Read more about aggregation in the docs here: https://restdb.io/docs/aggregate-data
  • Share on Facebook
  • Tweet
  • Add to Pocket
  • Share on LinkedIn
  • Send email

All Posts


Search

Topics

  • API
  • Authentication
  • Case study
  • Features
  • Howto
  • Integrations
  • Newsletter
  • Productivity
  • Prototyping
  • Tutorials
  • User

restdb.io is a fast and simple NoSQL cloud database service. With restdb.io you get schema, relations, REST API and an efficient multi-user admin UI for working with data.

Our customers use it for backends, business databases, API-first CMS, data collection and much more. It is easy to get started with the free development plan.

Start Building »

  • Site Links
  • Home Page
  • About Us
  • Contact
  • Blog
  • Templates Catalog
  • Cloud Service
  • Features
  • Pricing
  • Terms & Conditions
  • Privacy Policy
  • Sign Up »
  • Documentation
  • Overview
  • Getting Started
  • Coding against the API
  • Utils
  • Security and Admin
© 2025 restdb.io