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

CRUD API

Every model depending on the classType exposes a number of methods to perform crud operations on the database. The following methods are available for classType Vertex. A vertex in ArangoDB is just a normal document. It may or not be connected to another vertex through an edge. For more information abbout graphs go to the official documentation

Compatibility

This adapter implements the following methods:

MethodStatusCategory
createDoneDML
createEachDoneDML
updateDoneDML
upsertDoneDML
destroyDoneDML
findDoneDQL
countDoneDQL
sumDoneDQL
avgDoneDQL
normalizeDoneDQL
defineDoneDDL
dropDoneDDL

Create

The method used to insert a document into a collection.

Usage

const created = await User.create({
  full_name: "Angela W.",
  email: "angelow@gmail.com",
  password: "xxxxx"
}).meta({
  fetch: true
});

// Do something with created record.

the {meta: true} option is just one of the options available when impletementing the methods in waterline. Its beyond the scope of this documentation. If you want to learn more about this options, please visit the Sails Documentation

In our examples, we shall use the async and await for asynchrounous implementation. Its worth noting that you call as well use call back functions.

The above code is the same as the code below

await User.create({
  full_name: "Angela W.",
  email: "angelow@gmail.com",
  password: "xxxxx"
}).exec(function(error, created) {
  if (error) {
    //handle errorr
  }
  // handle the created record.
});
← letcreateEach →
  • Compatibility
  • Create
    • Usage
Sails-ArangoJs
Docs
Getting StartedAPI Reference
Community
User ShowcaseStack OverflowTwitter
More
BlogGitHub
Cloudhub Developer Community
Copyright © 2022 Cloud Hub Limited