toBase64()

返回ObjectId的base64编码字符串表示。

用法

import { ObjectId } from 'funtool';

const id = new ObjectId();
const base64 = id.toBase64(); // 例如 "Xx1/OxyZRAAAAAA"

签名

toBase64(): string

返回值

返回ObjectId字节的base64编码字符串。

注意事项

  • 比十六进制表示更紧凑
  • 使用标准base64编码
  • 长度始终为16个字符
  • URL安全变体可通过short()方法获得