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

Average of a numeric attribute

avg Method

The method used to get the average 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 avg = await User.avg("age");

// Do something with avg
const avg = await User.avg("age", { age: { $gt: 12 } });

// Do something with avg

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

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