veliovgroup / ostrio-Neo4jreactivity

Meteor.js Neo4j database reactivity layer
https://atmospherejs.com/ostrio/neo4jreactivity
BSD 3-Clause "New" or "Revised" License
51 stars 5 forks source link

Really have a problem the values don't back #56

Closed camilamacedo86 closed 9 years ago

camilamacedo86 commented 9 years ago

getShortDirections: function(origem,destination){

    var match = 'MATCH (from:Location { name:"'+origem+'" }), (to:Location { name: "'+destination+'"}) , path = (from)-[:CONNECTED_TO*]->(to) ';
    var ret = ' RETURN path AS shortestPath, ';
    var reduce = '  reduce(distance = 0, r in relationships(path) | distance+r.distance) AS totalDistance ';
    var order = '  ORDER BY totalDistance ASC  LIMIT 1 ';
    var query = match + " " + ret + " "+ reduce +" "+ order;

    var shortestPath;
    var totalDistance;
    Meteor.N4JDB.query(query, null, function(err, data){

        console.log( data.shortestPath );
        console.log( data.totalDistance );
        shortestPath = data.shortestPath;
        totalDistance = data.totalDistance;
    });

    return shortestPath;
},

The database consult :+1:

screen shot 2015-08-23 at 5 47 02 pm

Result in meteor application :+1:

=> Meteor server restarted I20150823-17:44:45.402(-3)? undefined I20150823-17:44:45.403(-3)? undefined

camilamacedo86 commented 9 years ago

@dr-dimitru please can you help me ? Don't came back the values. I can show for you . My skype is camilamacedogigin

dr-dimitru commented 9 years ago

Could you please console.log() both error and data? And a full query variable and copy/paste it to Neo4j console to make sure your query composed in right way

camilamacedo86 commented 9 years ago

@dr-dimitru the query are good. But the problem is when pass in the return don't came back yet after this came back the result . If you can call me in the skype I can show for you

dr-dimitru commented 9 years ago

It is async function, use Fibers: tutorial

dr-dimitru commented 9 years ago

@camilamacedo86 Solved?

dr-dimitru commented 9 years ago

@camilamacedo86 issue will be closed in a week due to no response from topic starter

dr-dimitru commented 9 years ago

closed due to no response from topic starter