Is there a way to return multiple aliases with a Neo4j call using the JS driver?

Hi again!
I was having issues trying to return multiple variables with the JS driver (returning both a & b in a single statement)

const drug = await'MATCH (a:thing1 {id: $id})
 MATCH (b:thing2 {id: $id}) CREATE (a)-[r:$rel {weight: $weight})->(b) 
RETURN a, b'

If I return just one variable, the records.length correctly updates with however many "a" is, but if I try adding in another return variable (like a, b) it doesn't add it to the results.records with a. Would I just need another statement to return the other variable, or is there something I'm missing?
Thanks :)


The number of records is equal to the number of rows of results. When you have RETURN a, b this adds b as an additional column in the returned records, not as an additional record by itself.

Looking at the Neo4j from Javascript article, take a look at the last example:

var query="MATCH (n:User) RETURN n, labels(n) as l LIMIT {limit}"
var params={limit: 10}
var cb=function(err,data) { console.log(JSON.stringify(data)) }



The variables in the RETURN do not change the number of records returned, but they do change the columns returned and the associated row results per record.

Oh ok got it, thank you!