Module: aerospike/filter

This module provides functions to create secondary index (SI) filter predicates for use in query operations via the Client#query command.

Source:
See:

Example

const Aerospike = require('aerospike')

Aerospike.connect().then(async (client) => {
  // find any records that have a recent location within 1000m radius of the specified coordinates
  let geoFilter = Aerospike.filter.geoWithinRadius('recent', 103.8, 1.305, 1000, Aerospike.indexType.LIST)
  let query = client.query('test', 'demo')
  query.where(geoFilter)

  let results = await query.results()
  for (let record in results) {
    console.log(record.bins.recent)
  }
  client.close()
})

Classes

SindexFilterPredicate

Methods


<static> contains(bin, value, indexType)

Filter for list/map membership.

The filter matches records with a bin that has a list or map value that contain the given string or integer.

Parameters:
Name Type Description
bin string

The name of the bin.

value string | number

The value that should be a member of the list or map in the bin.

indexType number

One of module:aerospike.indexType, i.e. LIST, MAPVALUES or MAPKEYS.

Since:
  • v2.0
Source:
Returns:

SI filter predicate, that can be applied to queries using Query#where.

Type
module:aerospike/filter~SindexFilterPredicate

<static> equal(bin, value)

String/integer equality filter.

The filter matches records with a bin that matches a specified string or integer value.

Parameters:
Name Type Description
bin string

The name of the bin.

value string

The filter value.

Source:
Returns:

SI filter predicate, that can be applied to queries using Query#where.

Type
module:aerospike/filter~SindexFilterPredicate

<static> geoContainsGeoJSONPoint(bin, value [, indexType])

Geospatial filter that matches regions that contain a given GeoJSON point.

Depending on the index type, the filter will match GeoJSON regions within list or map values as well (requires server

= 3.8).

Parameters:
Name Type Argument Default Description
bin string

The name of the bin.

value GeoJSON

GeoJSON point value.

indexType number <optional>
Aerospike.indexType.DEFAULT

One of module:aerospike.indexType, i.e. LIST or MAPVALUES.

Since:
  • v2.0
Source:
Returns:

SI filter predicate, that can be applied to queries using Query#where.

Type
module:aerospike/filter~SindexFilterPredicate

<static> geoContainsPoint(bin, lng, lat [, indexType])

Geospatial filter that matches regions that contain a given lng/lat coordinate.

Depending on the index type, the filter will match GeoJSON regions within list or map values as well (requires server

= 3.8).

Parameters:
Name Type Argument Default Description
bin string

The name of the bin.

lng number

Longitude of the point.

lat number

Latitude of the point.

indexType number <optional>
Aerospike.indexType.DEFAULT

One of module:aerospike.indexType, i.e. LIST or MAPVALUES.

Since:
  • v2.0
Source:
Returns:

SI filter predicate, that can be applied to queries using Query#where.

Type
module:aerospike/filter~SindexFilterPredicate

<static> geoWithinGeoJSONRegion(bin, value [, indexType])

Geospatial filter that matches points within a given GeoJSON region.

Depending on the index type, the filter will match GeoJSON values contained in list or map values as well (requires Aerospike server version >= 3.8).

Parameters:
Name Type Argument Default Description
bin string

The name of the bin.

value GeoJSON

GeoJSON region value.

indexType number <optional>
Aerospike.indexType.DEFAULT

One of module:aerospike.indexType, i.e. LIST or MAPVALUES.

Since:
  • v2.0
Source:
Returns:

SI filter predicate, that can be applied to queries using Query#where.

Type
module:aerospike/filter~SindexFilterPredicate

<static> geoWithinRadius(bin, lng, lat, radius [, indexType])

Geospatial filter that matches points within a radius from a given point.

Depending on the index type, the filter will match GeoJSON values contained in list or map values as well (requires Aerospike server version >= 3.8).

Parameters:
Name Type Argument Default Description
bin string

The name of the bin.

lng number

Longitude of the center point.

lat number

Latitude of the center point.

radius number

Radius in meters.

indexType number <optional>
Aerospike.indexType.DEFAULT

One of module:aerospike.indexType, i.e. LIST or MAPVALUES.

Since:
  • v2.0
Source:
Returns:

SI filter predicate, that can be applied to queries using Query#where.

Type
module:aerospike/filter~SindexFilterPredicate

<static> range(bin, min, max [, indexType])

Integer range filter.

The filter matches records with a bin value in the given integer range. The filter can also be used to match for integer values within the given range that are contained with a list or map by specifying the appropriate index type.

Parameters:
Name Type Argument Default Description
bin string

The name of the bin.

min number

Lower end of the range (inclusive).

max number

Upper end of the range (inclusive).

indexType number <optional>
Aerospike.indexType.DEFAULT

One of module:aerospike.indexType, i.e. LIST or MAPVALUES.

Source:
Returns:

SI filter predicate, that can be applied to queries using Query#where.

Type
module:aerospike/filter~SindexFilterPredicate