Search code examples
couchdblimitcouchdb-2.0

What is the maximum length of a CouchDB database name?


The reference I've found only says about allowed characters in a database name:

  • Name must begin with a lowercase letter (a-z)
  • Lowercase characters (a-z)
  • Digits (0-9)
  • Any of the characters _, $, (, ), +, -, and /.

but it doesn't say anything about the maximum length. CouchDB uses HTTP as a protocol, so, obviously, the database name length must be less than a maximum allowed URL length. But is there some native limitation in some configuration file? I plan to automatically generate databases names so I don't want any unexpected errors on server during the runtime.


Solution

  • There are no limit on a length of a database name, it's defined by OS maximum filename length (taking into account that db file name is going to have suffix and extension and therefore be longer than just db name) and http client's maximum supported URL length.

    Allowed length of URL in CouchDB can be controlled by configuration parameter [httpd] max_uri_length, but it is applied to all the requests, not only to db creation.