CipherStash
CipherStash Documentation

Range

Range supports range operations in queries.

Supported Types

A Range index can be defined on the following types

  • number
  • bigint
  • Date
  • boolean

Index Definition

CollectionSchema.define<Employee>("employees").indexedWith(mapping => ({
  dateOfBirth: mapping.Range("startDate")
})

Supported Query Operations

  • lt (less than)
  • lte (less than or equal)
  • eq (equal)
  • gt (greater than)
  • gte (greater than or equal)
  • between (indexed value is in between two supplied values)
let queryResult1 = await employees.all(
  employee => employee.startDate.eq(new Date(2021, 3, 21))
)

let queryResult2 = await employees.all(
  employee => employee.startDate.lte(new Date(2021, 3, 21))
)

let queryResult3 = await employees.all(
  employee => employee.startDate.between(
    new Date(2020, 1, 1),
    new Date(2021, 1, 1)
  )
)