Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Timestamp

Hierarchy

  • LongWithoutOverridesClass
    • Timestamp

Index

Constructors

constructor

  • Parameters

    Returns Timestamp

  • Parameters

    • value: { i: number; t: number }

      A pair of two values indicating timestamp and increment.

      • i: number
      • t: number

    Returns Timestamp

  • deprecated

    Please use Timestamp({ t: high, i: low }) or Timestamp(Long(low, high)) instead.

    Parameters

    • low: number

      the low (signed) 32 bits of the Timestamp.

    • high: number

      the high (signed) 32 bits of the Timestamp.

    Returns Timestamp

Properties

__isLong__

__isLong__: true

_bsontype

_bsontype: "Timestamp"

add

add: (addend: string | number | Long | Timestamp) => Long

Type declaration

and

and: (other: string | number | Long | Timestamp) => Long

Type declaration

comp

comp: (other: string | number | Long | Timestamp) => 0 | 1 | -1

Type declaration

compare

compare: (other: string | number | Long | Timestamp) => 0 | 1 | -1

Type declaration

    • Compares this Long's value with the specified's.

      Parameters

      Returns 0 | 1 | -1

      0 if they are the same, 1 if the this is greater and -1 if the given one is greater

div

div: (divisor: string | number | Long | Timestamp) => Long

Type declaration

divide

divide: (divisor: string | number | Long | Timestamp) => Long

Type declaration

    • Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned.

      Parameters

      Returns Long

      Quotient

eq

eq: (other: string | number | Long | Timestamp) => boolean

Type declaration

equals

equals: (other: string | number | Long | Timestamp) => boolean

Type declaration

    • Tests if this Long's value equals the specified's.

      Parameters

      Returns boolean

eqz

eqz: () => boolean

Type declaration

    • (): boolean

ge

ge: (other: string | number | Long | Timestamp) => boolean

Type declaration

getHighBits

getHighBits: () => number

Type declaration

    • (): number
    • Gets the high 32 bits as a signed integer.

      Returns number

getHighBitsUnsigned

getHighBitsUnsigned: () => number

Type declaration

    • (): number
    • Gets the high 32 bits as an unsigned integer.

      Returns number

getLowBits

getLowBits: () => number

Type declaration

    • (): number
    • Gets the low 32 bits as a signed integer.

      Returns number

getLowBitsUnsigned

getLowBitsUnsigned: () => number

Type declaration

    • (): number
    • Gets the low 32 bits as an unsigned integer.

      Returns number

getNumBitsAbs

getNumBitsAbs: () => number

Type declaration

    • (): number
    • Gets the number of bits needed to represent the absolute value of this Long.

      Returns number

greaterThan

greaterThan: (other: string | number | Long | Timestamp) => boolean

Type declaration

    • Tests if this Long's value is greater than the specified's.

      Parameters

      Returns boolean

greaterThanOrEqual

greaterThanOrEqual: (other: string | number | Long | Timestamp) => boolean

Type declaration

    • Tests if this Long's value is greater than or equal the specified's.

      Parameters

      Returns boolean

gt

gt: (other: string | number | Long | Timestamp) => boolean

Type declaration

gte

gte: (other: string | number | Long | Timestamp) => boolean

Type declaration

high

high: number

isEven

isEven: () => boolean

Type declaration

    • (): boolean
    • Tests if this Long's value is even.

      Returns boolean

isNegative

isNegative: () => boolean

Type declaration

    • (): boolean
    • Tests if this Long's value is negative.

      Returns boolean

isOdd

isOdd: () => boolean

Type declaration

    • (): boolean
    • Tests if this Long's value is odd.

      Returns boolean

isPositive

isPositive: () => boolean

Type declaration

    • (): boolean
    • Tests if this Long's value is positive.

      Returns boolean

isZero

isZero: () => boolean

Type declaration

    • (): boolean
    • Tests if this Long's value equals zero.

      Returns boolean

le

le: (other: string | number | Long | Timestamp) => boolean

Type declaration

lessThan

lessThan: (other: string | number | Long | Timestamp) => boolean

Type declaration

    • Tests if this Long's value is less than the specified's.

      Parameters

      Returns boolean

lessThanOrEqual

lessThanOrEqual: (other: string | number | Long | Timestamp) => boolean

Type declaration

    • Tests if this Long's value is less than or equal the specified's.

      Parameters

      Returns boolean

low

low: number

lt

lt: (other: string | number | Long | Timestamp) => boolean

Type declaration

    • This is an alias of {@link Long#lessThan}.

      Parameters

      Returns boolean

lte

lte: (other: string | number | Long | Timestamp) => boolean

Type declaration

mod

mod: (divisor: string | number | Long | Timestamp) => Long

Type declaration

modulo

modulo: (divisor: string | number | Long | Timestamp) => Long

Type declaration

mul

mul: (multiplier: string | number | Long | Timestamp) => Long

Type declaration

multiply

multiply: (multiplier: string | number | Long | Timestamp) => Long

Type declaration

    • Returns the product of this and the specified Long.

      Parameters

      Returns Long

      Product

ne

ne: (other: string | number | Long | Timestamp) => boolean

Type declaration

neg

neg: () => Long

Type declaration

negate

negate: () => Long

Type declaration

    • Returns the Negation of this Long's value.

      Returns Long

neq

neq: (other: string | number | Long | Timestamp) => boolean

Type declaration

not

not: () => Long

Type declaration

    • Returns the bitwise NOT of this Long.

      Returns Long

notEquals

notEquals: (other: string | number | Long | Timestamp) => boolean

Type declaration

    • Tests if this Long's value differs from the specified's.

      Parameters

      Returns boolean

or

or: (other: string | number | Long) => Long

Type declaration

    • Returns the bitwise OR of this Long and the specified.

      Parameters

      • other: string | number | Long

      Returns Long

rem

rem: (divisor: string | number | Long | Timestamp) => Long

Type declaration

shiftLeft

shiftLeft: (numBits: number | Long) => Long

Type declaration

    • Returns this Long with bits shifted to the left by the given amount.

      Parameters

      • numBits: number | Long

        Number of bits

      Returns Long

      Shifted Long

shiftRight

shiftRight: (numBits: number | Long) => Long

Type declaration

    • Returns this Long with bits arithmetically shifted to the right by the given amount.

      Parameters

      • numBits: number | Long

        Number of bits

      Returns Long

      Shifted Long

shiftRightUnsigned

shiftRightUnsigned: (numBits: number | Long) => Long

Type declaration

    • Returns this Long with bits logically shifted to the right by the given amount.

      Parameters

      • numBits: number | Long

        Number of bits

      Returns Long

      Shifted Long

shl

shl: (numBits: number | Long) => Long

Type declaration

shr

shr: (numBits: number | Long) => Long

Type declaration

shr_u

shr_u: (numBits: number | Long) => Long

Type declaration

shru

shru: (numBits: number | Long) => Long

Type declaration

sub

sub: (subtrahend: string | number | Long | Timestamp) => Long

Type declaration

subtract

subtract: (subtrahend: string | number | Long | Timestamp) => Long

Type declaration

    • Returns the difference of this and the specified Long.

      Parameters

      Returns Long

      Difference

toBigInt

toBigInt: () => bigint

Type declaration

    • (): bigint
    • Converts the Long to a BigInt (arbitrary precision).

      Returns bigint

toBytes

toBytes: (le?: boolean) => number[]

Type declaration

    • (le?: boolean): number[]
    • Converts this Long to its byte representation.

      Parameters

      • Optional le: boolean

        Whether little or big endian, defaults to big endian

      Returns number[]

      Byte representation

toBytesBE

toBytesBE: () => number[]

Type declaration

    • (): number[]
    • Converts this Long to its big endian byte representation.

      Returns number[]

      Big endian byte representation

toBytesLE

toBytesLE: () => number[]

Type declaration

    • (): number[]
    • Converts this Long to its little endian byte representation.

      Returns number[]

      Little endian byte representation

toInt

toInt: () => number

Type declaration

    • (): number
    • Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.

      Returns number

toNumber

toNumber: () => number

Type declaration

    • (): number
    • Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).

      Returns number

toSigned

toSigned: () => Long

Type declaration

    • Converts this Long to signed.

      Returns Long

toString

toString: (radix?: number) => string

Type declaration

    • (radix?: number): string
    • Converts the Long to a string written in the specified radix.

      throws

      RangeError If radix is out of range

      Parameters

      • Optional radix: number

        Radix (2-36), defaults to 10

      Returns string

toUnsigned

toUnsigned: () => Long

Type declaration

    • Converts this Long to unsigned.

      Returns Long

unsigned

unsigned: boolean

xor

xor: (other: string | number | Long) => Long

Type declaration

    • Returns the bitwise XOR of this Long and the given one.

      Parameters

      • other: string | number | Long

      Returns Long

Static Readonly MAX_VALUE

MAX_VALUE: Long

Methods

inspect

  • inspect(): string
  • Returns string

toJSON

  • toJSON(): { $timestamp: string }
  • Returns { $timestamp: string }

    • $timestamp: string

Static fromBits

  • fromBits(lowBits: number, highBits: number): Timestamp
  • Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits.

    Parameters

    • lowBits: number

      the low 32-bits.

    • highBits: number

      the high 32-bits.

    Returns Timestamp

Static fromInt

  • Returns a Timestamp represented by the given (32-bit) integer value.

    Parameters

    • value: number

    Returns Timestamp

Static fromNumber

  • Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned.

    Parameters

    • value: number

    Returns Timestamp

Static fromString

  • fromString(str: string, optRadix: number): Timestamp
  • Returns a Timestamp from the given string, optionally using the given radix.

    Parameters

    • str: string

      the textual representation of the Timestamp.

    • optRadix: number

      the radix in which the text is written.

    Returns Timestamp

Generated using TypeDoc