Skip to content

WhereClause.inAnyRange()

David Fahlander edited this page Nov 25, 2016 · 6 revisions

Since v1.3.0

Syntax

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

Parameters

indexOrPrimKey: String Name of an index or primary key registered in Version.stores()
ranges Array of Arrays defining ranges to search [[lowerBound, upperBound],...]
options Options of how to tread range starts and ends
options.includeLowers Whether lowerBound should be included or not. Default: true. Specify 'false' explicitly if lowerBound should NOT be included in the results.
options.includeUppers Whether 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});
Clone this wiki locally