Sails-ArangoJs

Sails-ArangoJs

  • Docs
  • API

›CRUD API

Getting Started

  • Installation
  • Creating Models
  • Testing

CRUD API

  • let
  • create
  • createEach
  • update
  • updateOne
  • upsert
  • find
  • findOne
  • sum
  • avg
  • destroy
  • count
  • aggregate
  • sample
  • findNear
  • findWithCount

Graph & Transactions

  • Implementing transacations
  • Graph

Going Native

  • Native Methods
  • Foxx Services

The sum of a numeric attribute

sum Method

The method used to get the summation in a model attribute. A find criteria can be used to filter before finding an average.

the attribute must be of type number

Usage

const sum = await Cart.sum("price");

// Do something with sum.

The above method sums the price attribute of the model cart.

const sum = await Cart.sum("price", { category: "groceries" });

// Do something with sum.

The above method sums the price attribute of the model cart where category of the products is groceries.

Please refer to the find methods for the operators that can be implemented in the criteria.

← findOneavg →
  • sum Method
    • Usage
Sails-ArangoJs
Docs
Getting StartedAPI Reference
Community
User ShowcaseStack OverflowTwitter
More
BlogGitHub
Cloudhub Developer Community
Copyright © 2022 Cloud Hub Limited