NoSQL Data Modeling Confusion
Perhaps I am too new to NoSQL and I’ve been living in a relational database far too long, but I did have some questions and figured I would ask the community.
I watched the Couchbase 2.0 tutorial and demo and he referenced a game with data objects “Player”, “Item”, and “Monster”. Since this is not a real world example for me I will use my example, then ask questions.
Suppose we have Users and Groups, where users can have one or many authorized groups. In a relational database this is how I would setup the data.
User is defined as:
Group is defined as:
User Authorization to Group:
Typical queries are as follows:
Search for user by ID (this one is easy since the key is ID)
Search for user by username
Search for group by ID (this one is easy since the key is ID)
Get all groups for a user
Get all users for a group
Since membase/couchbase are key/value based...how do we accomplish these queries without going through ALL keys? And in Spymemcached you can’t get all keys and there’s no way to query. Again sorry for my relational database mind-set. I understand that Couchbase 2.0 helps with some of this with views, but I have not seen anything in Spymemcached to call a view let alone with parameters.
The other piece I didn’t really understand is in Spymemcached they reference CAS in various places, but I have yet to find anything about what CAS is supposed to be…and I’ve googled a fair amount to find it.
Thanks for all of your help. Sorry in advance for my newbie questions.