Class Timestamp

Hierarchy (view full)

Constructors

  • Parameters

    • int: bigint

      A 64-bit bigint representing the Timestamp.

    Returns Timestamp

  • Parameters

    • long: Long

      A 64-bit Long representing the Timestamp.

    Returns Timestamp

  • Parameters

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

      A pair of two values indicating timestamp and increment.

      • i: number
      • t: number

    Returns Timestamp

Properties

__isLong__: boolean

Not applicable to Timestamp. Use the bsonType symbol or _bsontype === 'Timestamp' to identify a Timestamp.

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

Type declaration

    • (addend): Long
    • Returns the sum of this and the specified Long.

      Parameters

      • addend:
            | string
            | number
            | Long
            | Timestamp

      Returns Long

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (other): Long
    • Returns the sum of this and the specified Long.

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns Long

      Sum

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (other): -1 | 0 | 1
    • This is an alias of Long.compare

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns -1 | 0 | 1

Use .compare() for general comparison, or .equals(), .lessThan(), .greaterThan() for specific cases.

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

Type declaration

    • (other): -1 | 0 | 1
    • Compares this Long's value with the specified's.

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns -1 | 0 | 1

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

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

Type declaration

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

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

      Parameters

      • divisor:
            | string
            | number
            | Long
            | Timestamp

      Returns Long

      Quotient

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (other): boolean
    • This is an alias of Long.equals

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns boolean

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

Type declaration

    • (other): boolean
    • Tests if this Long's value equals the specified's.

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

        Other value

      Returns boolean

eqz: (() => boolean)

Type declaration

    • (): boolean
    • This is an alias of Long.isZero

      Returns boolean

Compare .t and .i against 0 explicitly.

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

Type declaration

getHighBits: (() => number)

Type declaration

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

      Returns number

Incompatible with Timestamp: returns a signed integer, but Timestamp is always unsigned. Use .t for seconds since the Unix epoch.

getHighBitsUnsigned: (() => number)

Type declaration

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

      Returns number

Not applicable to Timestamp; use .t for seconds since the Unix epoch.

getLowBits: (() => number)

Type declaration

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

      Returns number

Incompatible with Timestamp: returns a signed integer, but Timestamp is always unsigned. Use .i for the increment ordinal.

getLowBitsUnsigned: (() => number)

Type declaration

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

      Returns number

Not applicable to Timestamp; use .i for the increment ordinal.

getNumBitsAbs: (() => number)

Type declaration

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

      Returns number

Not applicable to Timestamp.

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

Type declaration

    • (other): boolean
    • Tests if this Long's value is greater than the specified's.

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns boolean

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

Type declaration

    • (other): boolean
    • Tests if this Long's value is greater than or equal the specified's.

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns boolean

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

Type declaration

    • (other): boolean
    • This is an alias of Long.greaterThan

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns boolean

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

Type declaration

high: number

Not applicable to Timestamp; use .t instead.

isEven: (() => boolean)

Type declaration

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

      Returns boolean

Not applicable to Timestamp; tests parity of the increment only.

isNegative: (() => boolean)

Type declaration

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

      Returns boolean

Not applicable to Timestamp as the underlying Long is always unsigned (is always false).

isOdd: (() => boolean)

Type declaration

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

      Returns boolean

Not applicable to Timestamp; tests parity of the increment only.

isPositive: (() => boolean)

Type declaration

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

      Returns boolean

Not applicable to Timestamp as the underlying Long is always unsigned (is always true).

isZero: (() => boolean)

Type declaration

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

      Returns boolean

Compare .t and .i against 0 explicitly.

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

Type declaration

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

Type declaration

    • (other): boolean
    • Tests if this Long's value is less than the specified's.

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns boolean

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

Type declaration

    • (other): boolean
    • Tests if this Long's value is less than or equal the specified's.

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns boolean

low: number

Not applicable to Timestamp; use .i instead.

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

Type declaration

    • (other): boolean
    • This is an alias of Long#lessThan.

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns boolean

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

Type declaration

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

Type declaration

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (divisor): Long
    • Returns this Long modulo the specified.

      Parameters

      • divisor:
            | string
            | number
            | Long
            | Timestamp

      Returns Long

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (multiplier): Long
    • Returns the product of this and the specified Long.

      Parameters

      • multiplier:
            | string
            | number
            | Long
            | Timestamp

        Multiplier

      Returns Long

      Product

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (other): boolean
    • This is an alias of Long.notEquals

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns boolean

neg: (() => Long)

Type declaration

Not applicable to Timestamp as the underlying Long is always unsigned.

negate: (() => Long)

Type declaration

    • (): Long
    • Returns the Negation of this Long's value.

      Returns Long

Not applicable to Timestamp as the underlying Long is always unsigned.

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

Type declaration

    • (other): boolean
    • This is an alias of Long.notEquals

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns boolean

not: (() => Long)

Type declaration

    • (): Long
    • Returns the bitwise NOT of this Long.

      Returns Long

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (other): boolean
    • Tests if this Long's value differs from the specified's.

      Parameters

      • other:
            | string
            | number
            | Long
            | Timestamp

      Returns boolean

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

Type declaration

    • (other): Long
    • Returns the bitwise OR of this Long and the specified.

      Parameters

      • other: string | number | Long

      Returns Long

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (numBits): Long
    • Returns this Long with bits shifted to the left by the given amount.

      Parameters

      • numBits: number | Long

        Number of bits

      Returns Long

      Shifted Long

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (numBits): Long
    • 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

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (numBits): Long
    • 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

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

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

Type declaration

    • (subtrahend): Long
    • Returns the difference of this and the specified Long.

      Parameters

      • subtrahend:
            | string
            | number
            | Long
            | Timestamp

        Subtrahend

      Returns Long

      Difference

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

toBigInt: (() => bigint)

Type declaration

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

      Returns bigint

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

Type declaration

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

      Parameters

      • Optionalle: boolean

        Whether little or big endian, defaults to big endian

      Returns number[]

      Byte representation

Not applicable to Timestamp; use .t for seconds since the Unix epoch, or .i for the increment ordinal.

toBytesBE: (() => number[])

Type declaration

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

      Returns number[]

      Big endian byte representation

Not applicable to Timestamp; use .t for seconds since the Unix epoch, or .i for the increment ordinal.

toBytesLE: (() => number[])

Type declaration

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

      Returns number[]

      Little endian byte representation

Not applicable to Timestamp; use .t for seconds since the Unix epoch, or .i for the increment ordinal.

toInt: (() => number)

Type declaration

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

      Returns number

Not applicable to Timestamp; use .t for seconds since the Unix epoch, or .i for the increment ordinal.

toNumber: (() => number)

Type declaration

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

      Returns number

Not applicable to Timestamp; use .t for seconds since the Unix epoch, or .i for the increment ordinal.

toSigned: (() => Long)

Type declaration

    • (): Long
    • Converts this Long to signed.

      Returns Long

Not applicable to Timestamp as the underlying Long is always unsigned.

toString: ((radix?: number) => string)

Type declaration

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

      Parameters

      • Optionalradix: number

        Radix (2-36), defaults to 10

      Returns string

      RangeError If radix is out of range

toUnsigned: (() => Long)

Type declaration

    • (): Long
    • Converts this Long to unsigned.

      Returns Long

Not applicable to Timestamp as the underlying Long is always unsigned (this is a no-op).

unsigned: boolean

Not applicable to Timestamp as the underlying Long is always unsigned (is always true).

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

Type declaration

    • (other): Long
    • Returns the bitwise XOR of this Long and the given one.

      Parameters

      • other: string | number | Long

      Returns Long

Not applicable to Timestamp; Timestamp is not intended to be used as a Long.

MAX_VALUE: Long

Use Long.MAX_UNSIGNED_VALUE instead.

Accessors

  • get _bsontype(): "Timestamp"
  • Returns "Timestamp"

  • get [bsonType](): "Timestamp"
  • Returns "Timestamp"

  • get i(): number
  • An incrementing ordinal for operations within a given second.

    Returns number

  • get t(): number
  • A time_t value measuring seconds since the Unix epoch

    Returns number

Methods

  • Parameters

    • Optionaldepth: number
    • Optionaloptions: unknown
    • Optionalinspect: InspectFn

    Returns string

  • Returns {
        $timestamp: string;
    }

    • $timestamp: string
  • 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

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

    Parameters

    • value: number

    Returns Timestamp

    Stores value in the low 32 bits (increment), leaving t = 0. Use new Timestamp({ t, i }) or Timestamp.fromBits(lowBits, highBits) for explicit construction.

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

    Parameters

    • value: number

    Returns Timestamp

    Splits value across (t, i) as a uint64; the result rarely matches user intent. Use new Timestamp({ t, i }) or Timestamp.fromBits(lowBits, highBits) for explicit construction.

  • 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