link walking -- order between keys and objects does not match

José Ghislain Quenum jose.quenum at googlemail.com
Mon Jun 4 17:34:06 EDT 2012


Hi all,
I have two buckets 'users' and 'projects'. A user object can have a link to a project object with tag name "owns". And there can be many such links with a given user object. I try to walk the "owns" link from a user object with the following syntax:
(I am using riak.js and coffeescript, but I guess the syntax is straightforward :-))

@db_client.walk 'users', user_key, [["_", 'owns', 1]], (error, linked_data) =>

Technically, the link walking seems to be working fine. It returns an object with two entries: 
1- entry "0" with an array of keys
2 - entry "1" with an array of objects. 

However, the order of the objects and the keys does not match. Between several iterations I can see the order changing. This later fails the logic of my program since I use the key to fetch more information about a project and display it at a later stage in the program. 

My question is, is there something I am doing wrong in the syntax of my link walking? Is this the normal way riak is implemented? (i.e. a loose coupling between keys and objects during link walking)? What's the best way fix this? Ignore the objects, stick with the keys and go fetch the actual objects from the projects bucket? That doesn't sound efficient to me though.
Any thought?
José

PS: As I said, I am using Riak.js in a Node.js project with coffeescript





More information about the riak-users mailing list