API 参考
    正在准备搜索索引...

    A class representation of the BSON ObjectId type.

    层级 (查看层级一览)

    索引

    构造函数

    • Create an ObjectId type

      参数

      • 可选inputId: string | number | ObjectId | Uint8Array<ArrayBufferLike> | ObjectIdLike

        Can be a 24 character hex string, 12 byte binary Buffer, or a number.

      返回 ObjectId

    属性

    cacheHexString: boolean

    访问器

    • get _bsontype(): "ObjectId"

      返回 "ObjectId"

    • get id(): Uint8Array

      The ObjectId bytes

      返回 Uint8Array

    方法

    • Compares the equality of this ObjectId with otherID.

      参数

      返回 boolean

    • Returns the generation date (accurate up to the second) that this ID was generated.

      返回 Date

    • 返回 string

    • Returns the ObjectId id as a 24 character hex string representation

      返回 string

    • Converts to its JSON the 24 character hex string representation.

      返回 string

    • Converts the id into a 24 character hex string for printing, unless encoding is provided.

      参数

      • 可选encoding: "base64" | "hex"

        hex or base64

      返回 string

    • Creates an ObjectId instance from a base64 string

      参数

      • base64: string

      返回 ObjectId

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

      参数

      • hexString: string

        create a ObjectId from a passed in 24 character hexstring.

      返回 ObjectId

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

      参数

      • time: number

        an integer number representing a number of seconds.

      返回 ObjectId

    • Generate a 12 byte id buffer used in ObjectId's

      参数

      • 可选time: number

        pass in a second based timestamp.

      返回 Uint8Array

    • Checks if a value is a valid bson ObjectId

      参数

      • id: string | number | ObjectId | Uint8Array<ArrayBufferLike> | ObjectIdLike

        ObjectId instance to validate.

      返回 boolean