Search Docs
toJSON()
返回ObjectId的24字符十六进制字符串表示用于JSON序列化。
import { ObjectId } from 'funtool'; const id = new ObjectId(); const json = JSON.stringify({ id }); // {"id":"5f1d7f3b1c9d440000000000"}
toJSON(): string
返回24字符的小写十六进制字符串。