Riak does not support inline updating (check mongo) so in order to update any 
key in your json object you need to pull the whole object (value), make your 
changes and write it back. 

I would make one json object like so, recording all the data in one place. All 
denormalized like. 

/riak/subject/001

{ 
 "name" : "First Last",
 "age_int": 55
 "subject": "001",
 "complication": [0,1]
}



@siculars
http://siculars.posthaven.com

Sent from my iRotaryPhone

On Jun 4, 2013, at 21:05, Kartik Thakore <[email protected]> wrote:

> That is what I was thinking. But denormalizing the subject field would
> mean when I update the subject field the data stuff won't be updated.
> Is there a solution for that? Or should I handle that with the
> application code?
> 
> On Tue, Jun 4, 2013 at 8:49 PM, Alexander Sicular <[email protected]> wrote:
>> You don't. Riak is not a relational system. As you've noted, you should 
>> demoralize your data.
>> 
>> 
>> @siculars
>> http://siculars.posthaven.com
>> 
>> Sent from my iRotaryPhone
>> 
>> On Jun 4, 2013, at 20:43, Kartik Thakore <[email protected]> wrote:
>> 
>>> Hi,
>>> 
>>> I have spent the last couple hours trying to understand how to store
>>> and/or search relationships between buckets of information. Currently,
>>> I have two buckets (will have more with more relationships) 'subjects'
>>> and 'data'. In subjects I store data such as:
>>> 
>>> http://.../riak/subjects/001 has {  "name" : "First Last",  "age_int": 25 },
>>> http://.../riak/subjects/002 has {  "name" : "First Last",  "age_int": 55 }
>>> 
>>> so on.
>>> 
>>> and in 'data' I have :
>>> 
>>> { "subject" : "001", "complication": [0, 1] },
>>> { "subject" : "002", "complication": [1] }
>>> 
>>> 
>>> Now my question is how do I query information like:
>>> 
>>> Where Subject has age_int between 20 to 100 & complication includes 1?
>>> 
>>> I thought I could accomplish this with map reduce, but I can access
>>> only one bucket at a time. Is there a different way I should be
>>> storing data like this? Or should I denormalize the subject into
>>> 'data'?
>>> 
>>> Regards,
>>> Kartik
>>> 
>>> _______________________________________________
>>> riak-users mailing list
>>> [email protected]
>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to