UUIDs in CouchDB

后端 未结 2 507
渐次进展
渐次进展 2021-02-13 18:58

I am wondering about the format UUIDs are by default represented in CouchDB. While the RFC 4122 describes UUIDs like 550e8400-e29b-11d4-a716-446655440000, CouchDB u

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-13 19:34

    Technically we don't use the rfc standard for uuids as you've noticed. Version four uuids reserve something like four bits to specify the version of uuid. We also don't format them with the hyphens that are generally seen in other implementations.

    CouchDB uuids are 16 random bytes formatted as hex. Roughly speaking that's a v4 uuid but not rfc compliant.

    Regardless of the specifics, there's really not much of an issue in practice. You generally shouldn't try to interpret a uuid unless you're trying to do some sort out-of-band analysis. CouchDB will never interpret uuids, we only rely on the properties of randomness involved therein.

    Bottom line would be to not worry about it and just treat them as strings after generation.

提交回复
热议问题