WhereClause.inAnyRange()

Since v1.3.0

Syntax

table.where(indexOrPrimKey).inAnyRange(ranges, options)

Parameters

indexOrPrimKey: StringName of an index or primary key registered in Version.stores()
rangesArray of Arrays defining ranges to search [[lowerBound, upperBound],...]
optionsOptions of how to tread range starts and ends
options.includeLowersWhether lowerBound should be included or not. Default: true. Specify 'false' explicitly if lowerBound should NOT be included in the results.
options.includeUppersWhether upperBound should be included or not. Default: false

Return Value

Collection

Remarks

Returns a collection where index is within any of the given ranges.

Sample

// Give children and elders a rebate of 50%:
db.customers.where('age')
  .inAnyRange([[0, 18], [65, Infinity]])
  .modify({Rebate: 1/2});

Table of Contents