couchdb icon indicating copy to clipboard operation
couchdb copied to clipboard

Add nanoid and ulid _id generation options

Open janl opened this issue 1 year ago • 5 comments

https://github.com/ulid/spec https://github.com/ai/nanoid

janl avatar Jul 25 '23 13:07 janl

Good idea, Jan.

There is a uuid7, too:

  • https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-03.html#name-uuid-version-7
  • https://pypi.org/project/uuid7/

nickva avatar Jul 25 '23 13:07 nickva

How would this look like in practice? Something like a configuration option where the user may choose with algorithm to use for generating the _id values?

pgj avatar Jul 25 '23 19:07 pgj

We could pick the algorithm to use when a doc is created without an _id fields.

Also there is an API for users to generate block of UUIDs

  • https://docs.couchdb.org/en/stable/api/server/common.html#uuids
  • https://docs.couchdb.org/en/stable/config/misc.html#uuids-configuration

That's mostly from the days when UUIDs libraries in clients weren't ubiquitous.

nickva avatar Jul 25 '23 20:07 nickva

pgj commented 18 hours ago How would this look like in practice? Something like a configuration option where the user may choose with algorithm to use for generating the _id values?

we already have that, I was hoping we can just add the new algos

janl avatar Jul 26 '23 14:07 janl

Ah, I see. Thanks for the answers.

pgj avatar Jul 26 '23 14:07 pgj