user3740179
user3740179

Reputation: 143

Random name of database

I create a new user in CouchDB this way:

curl -X  PUT   MY_URL  / _users / org.couchdb.user:userName 
 -H "Accept: application/json" \
 -H "Content-Type: application/json" \
 -d  '{"name": "userName", "password": "pass", "roles": [], "type": "user"}'

This method creates two things: document in '_users database' and a database. I have a problem with the database because the name of this one is chosen randomly. The questions: How can I set the name of the database when I create a new user? Or How can I retrieve the name which was created randomly?

Upvotes: 0

Views: 387

Answers (1)

richard
richard

Reputation: 677

What if, when generating the user name, you save the value to obtain the hexadecimal value?

The database by users in CouchDB is the hexadecimal value of the user name. Example if the username is john the database generated for this user is userdb-6a6f686e.

http://docs.couchdb.org/en/stable/config/couch-peruser.html

Upvotes: 1

Related Questions