API 参考
    正在准备搜索索引...
    interface DeserializeOptions {
        allowObjectSmallerThanBufferSize?: boolean;
        bsonRegExp?: boolean;
        fieldsAsRaw?: Document;
        index?: number;
        promoteBuffers?: boolean;
        promoteLongs?: boolean;
        promoteValues?: boolean;
        raw?: boolean;
        useBigInt64?: boolean;
        validation?: {
            utf8: boolean | Record<string, true> | Record<string, false>;
        };
    }
    索引

    属性

    allowObjectSmallerThanBufferSize?: boolean

    allows the buffer to be larger than the parsed BSON object.

    bsonRegExp?: boolean

    return BSON regular expressions as BSONRegExp instances.

    fieldsAsRaw?: Document

    allow to specify if there what fields we wish to return as unserialized raw buffer.

    index?: number

    Offset into buffer to begin reading document from

    promoteBuffers?: boolean

    when deserializing a Binary will return it as a node.js Buffer instance.

    promoteLongs?: boolean

    when deserializing a Long will fit it into a Number if it's smaller than 53 bits.

    promoteValues?: boolean

    when deserializing will promote BSON values to their Node.js closest equivalent types.

    raw?: boolean
    useBigInt64?: boolean

    when deserializing a Long will return as a BigInt.

    validation?: { utf8: boolean | Record<string, true> | Record<string, false> }

    Allows for opt-out utf-8 validation for all keys or specified keys. Must be all true or all false.

    // disables validation on all keys
    validation: { utf8: false }

    // enables validation only on specified keys a, b, and c
    validation: { utf8: { a: true, b: true, c: true } }

    // disables validation only on specified keys a, b
    validation: { utf8: { a: false, b: false } }