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

Finding Documents

findNear Method

This is a Geospatial method that can be used to calculate the distance between coordinated.

The criteria must be an object. and must have a radius attribute.

The field type must be a geoJson object eg [ 36.8868117, -1.21821 ]

Usage

const location = {
  latitude: 1.29230234,
  longitude: -37.78981298
};

const stores = await Store.findNear(
  { StoreLocation: location, radius: 10000 },
  { select: ["StoreName", "Location"] }
).limit(20);

// Do something with stores.

The method will return documents in array of model attributes plus a distance attribute;

You can apply the sort and limit methods.

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