This module provides functions to create secondary index (SI) filter
predicates for use in query operations via the Client#query
command.
- Description:
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')
const Context = Aerospike.cdt.Context
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, new Context().addListIndex(0))
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
Methods
(static) contains(bin, value, indexType, context) → {module:aerospike/filter~SindexFilterPredicate}
Filter for list/map membership.
- Description:
The filter matches records with a bin that has a list or map value that contain the given string or integer.
- Source:
- Since:
- v2.0
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 |
context |
Object | The |
Returns:
SI
filter predicate, that can be applied to queries using Query#where
.
(static) equal(bin, value) → {module:aerospike/filter~SindexFilterPredicate}
String/integer equality filter.
- Description:
The filter matches records with a bin that matches a specified string or integer value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
bin |
string | The name of the bin. |
value |
string | The filter value. |
Returns:
SI
filter predicate, that can be applied to queries using Query#where
.
(static) geoContainsGeoJSONPoint(bin, value, indexTypeopt, context) → {module:aerospike/filter~SindexFilterPredicate}
Geospatial filter that matches regions that contain a given GeoJSON point.
- Description:
Depending on the index type, the filter will match GeoJSON regions within list or map values as well (requires server
= 3.8).
- Source:
- Since:
- v2.0
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
bin |
string | The name of the bin. |
||
value |
GeoJSON | GeoJSON point value. |
||
indexType |
number |
<optional> |
Aerospike.indexType.DEFAULT
|
One of |
context |
Object | The |
Returns:
SI
filter predicate, that can be applied to queries using Query#where
.
(static) geoContainsPoint(bin, lng, lat, indexTypeopt, context) → {module:aerospike/filter~SindexFilterPredicate}
Geospatial filter that matches regions that contain a given lng/lat coordinate.
- Description:
Depending on the index type, the filter will match GeoJSON regions within list or map values as well (requires server
= 3.8).
- Source:
- Since:
- v2.0
Parameters:
Name | Type | Attributes | 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 |
context |
Object | The |
Returns:
SI
filter predicate, that can be applied to queries using Query#where
.
(static) geoWithinGeoJSONRegion(bin, value, indexTypeopt, context) → {module:aerospike/filter~SindexFilterPredicate}
Geospatial filter that matches points within a given GeoJSON region.
- Description:
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).
- Source:
- Since:
- v2.0
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
bin |
string | The name of the bin. |
||
value |
GeoJSON | GeoJSON region value. |
||
indexType |
number |
<optional> |
Aerospike.indexType.DEFAULT
|
One of |
context |
Object | The |
Returns:
SI
filter predicate, that can be applied to queries using Query#where
.
(static) geoWithinRadius(bin, lng, lat, radius, indexTypeopt, context) → {module:aerospike/filter~SindexFilterPredicate}
Geospatial filter that matches points within a radius from a given point.
- Description:
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).
- Source:
- Since:
- v2.0
Parameters:
Name | Type | Attributes | 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 |
context |
Object | The |
Returns:
SI
filter predicate, that can be applied to queries using Query#where
.
(static) range(bin, min, max, indexTypeopt, context) → {module:aerospike/filter~SindexFilterPredicate}
Integer range filter.
- Description:
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.
- Source:
Parameters:
Name | Type | Attributes | 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 |
context |
Object | The |
Returns:
SI
filter predicate, that can be applied to queries using Query#where
.