incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Grobmeier <grobme...@gmail.com>
Subject Beginners approach of designing documents
Date Mon, 16 Sep 2013 09:30:13 GMT
Hi all,

for more than a decade I used relational databases. For a tiny project I
would like to try NoSQL and CouchDB and see for myself why people are so
fond of it. For me it is not much about tons of data. I am using
AngularJS and PHP and thought a schemaless database would fit nicely.

While I think I found the approach for most of my app, I am unsure about
one specific thing. I would like to enable my users to register and add
a book to their personal collection.

My approach would be to create a database with books first. Like:

{_id: 1, functional:"my-book", title:"my title", ... }

Second I would like to create a database with my users, like:

{_id: 20, email : "john@example.com", pass : "hashed", salt : "salt",
books : [ 1, 2, 3, 4 ...] }

When a user logs in, I would like to search for him by email and check
user credentials. When it succeeds I would look up all the books in his
collection.

On the net somebody wrote I should create a database per user. But this
seems completely wrong to me. Right?

I am a little concerned because I am referencing books from my user
object. Is this the right approach?

Or do I miss something?

Glad over all links, points, hints and so on.

Thanks!
Christian

Mime
View raw message