ObjectId

module

  ObjectId

since

  0.0.1

author

  Eduardo Astolfi eastolfi91@gmail.com

copyright

  2016 Eduardo Astolfi eastolfi91@gmail.com

license

  MIT Licensed

classdesc

  Represents the BSON ObjectId type

param

  Can be a 24 byte hex string, a 12 byte binary string or a Number.

### Hierarchy

- ObjectId

## Index

### Constructors

- constructor

### Properties

- ___id
- _bsontype
- binaryParser
- id
- logger
- cacheHexString
- index

### Accessors

- generationTime

### Methods

- equals
- generate
- getInc
- getTimestamp
- returnHash
- toHexString
- toJSON
- toString
- createFromHexString
- createFromTime
- createPk

## Constructors

### constructor

- new ObjectId(id?: string | number): ObjectId

- - Defined in document/ObjectId.ts:56

  #### Parameters

  - ##### Optional id: string | number

  #### Returns ObjectId

## Properties

### Private ___id

___id: string

- Defined in document/ObjectId.ts:53

### Private _bsontype

_bsontype: string = "ObjectId"

- Defined in document/ObjectId.ts:52

### binaryParser

binaryParser: BinaryParser

- Defined in document/ObjectId.ts:55

### id

id: string

- Defined in document/ObjectId.ts:56

### Protected logger

logger: JSWLogger

- Defined in document/ObjectId.ts:47

### Static Private cacheHexString

cacheHexString: string

- Defined in document/ObjectId.ts:49

### Static index

index: number = 0

- Defined in document/ObjectId.ts:50

## Accessors

### generationTime

- get generationTime(): string | number
- set generationTime(value: string | number): void

- - Defined in document/ObjectId.ts:263

  #### Returns string | number

- - Defined in document/ObjectId.ts:267

  #### Parameters

  - ##### value: string | number

  #### Returns void

## Methods

### equals

- equals(otherID: any): boolean

- - Defined in document/ObjectId.ts:241

  Compares the equality of this ObjectId with [otherID].

  method

    ObjectId#equals

  #### Parameters

  - ##### otherID: any

    ObjectId instance to compare against.

  #### Returns boolean

  The result of comparing two ObjectId"s

### Private generate

- generate(time?: string | number): string

- - Defined in document/ObjectId.ts:178

  Generate a 12 byte id string used in ObjectId"s

  method

    ObjectId#generate

  #### Parameters

  - ##### Optional time: string | number

  #### Returns string

  The 12 byte id binary string.

### Private getInc

- getInc(): number

- - Defined in document/ObjectId.ts:153

  Update the ObjectId index used in generating new ObjectId"s on the driver

  method

    ObjectId#get_inc

  #### Returns number

  Next index value.

### getTimestamp

- getTimestamp(): Date

- - Defined in document/ObjectId.ts:254

  Returns the generation time in seconds that this ID was generated.

  method

    ObjectId#getTimestamp

  #### Returns Date

  Number of seconds in the timestamp part of the 12 byte id.

### returnHash

- returnHash(length: number): string

- - Defined in document/ObjectId.ts:157

  #### Parameters

  - ##### length: number

  #### Returns string

### toHexString

- toHexString(): string

- - Defined in document/ObjectId.ts:100

  Return the ObjectId id as a 24 byte hex string representation

  method

    ObjectId#toHexString

  #### Returns string

  The 24 byte hex string representation.

### toJSON

- toJSON(): string

- - Defined in document/ObjectId.ts:141

  Alias for {@link ObjectId#toHexString}

  method

    Cursor#next

  #### Returns string

### toString

- toString(): string

- - Defined in document/ObjectId.ts:132

  Alias for {@link ObjectId#toHexString}

  method

    Cursor#next

  #### Returns string

### Static createFromHexString

- createFromHexString(hexString: any): ObjectId

- - Defined in document/ObjectId.ts:286

  Creates an ObjectId from a hex string representation of an ObjectId.

  method

    ObjectId#createFromHexString

  #### Parameters

  - ##### hexString: any

    An ObjectId 24 byte hexstring representation.

  #### Returns ObjectId

  The created ObjectId

### Static createFromTime

- createFromTime(time: any): ObjectId

- - Defined in document/ObjectId.ts:318

  Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.

  method

    ObjectId#createFromTime

  #### Parameters

  - ##### time: any

    A number of seconds.

  #### Returns ObjectId

  The created ObjectId

### Static createPk

- createPk(): ObjectId

- - Defined in document/ObjectId.ts:333

  Creates an ObjectId from a second based number, with the rest of the ObjectId zeroed out. Used for comparisons or sorting the ObjectId.

  method

    ObjectId#createPk

  #### Returns ObjectId

  return the created ObjectId

Generated using TypeDoc