I have following query which is giving me what I want

'START user=node({userId}), other=node({otherId})',
      'MATCH (user) -[rels?]-> (other)',
      'RETURN rels'

but I'm unable to access the object it send.I need following high 
lightened object which I have no idea to access.Object is inspected in 
console below. 



[{"rels":{"db":{"url":"http://localhost:7474","_request":{},"_root":..........{},"start":"http://localhost:7474/db/data/node/222","property":"http://localhost:7474/db/data/relationship/245/properties/{key}","self":"http://localhost:7474/db/data/relationship/245","properties":"http://localhost:7474/db/data/relationship/245/properties";,
"type":"knows"
,"end":"http://localhost:7474/db/data/node/196","data":{"created_at":1372829579654}},"_start":{"db":{"url":"http://localhost:7474","_request":{},"_root":...



Full program:

User.checkRelationship = function (user, fid, callback) {

  var uids = [user.uid, fid];
  async.map(uids, User.by_uid, function (err, usernodes) {
    if (!err && usernodes && usernodes.length) {
    User.relsCheck(usernodes, function (err, rels) {
        if (!err && rels) {
          callback(null, rels);  // inpecting rels gave the above object 
but I want to return rels.type , but is not giving i want
        } else {
          callback(err || new Error('relationships does\'nt exists'));
        }
      });
    } else {
      callback(err || new Error('Unable to fetch user nodes: ' + 
uids.join(',')));
    }
  });
};


User.relsCheck = function (nodes, callback) {
  if (nodes.length !== 2) {
    return callback(new Error('Invalid/insufficient arguments'));
  }
  var query = [
      'START user=node({userId}), other=node({otherId})',
      'MATCH (user) -[rels?]-> (other)',
      'RETURN rels'
  ].join('\n');

  var params = {
    userId: nodes[0].node().id,
    otherId: nodes[1].node().id,
  };

   db.query(query, params, callback);
};








-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to