You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is no "proper" way to check if a value exists or not in a Record without trying to access and catching for errors.
Take this oversimplified example:
constqueries=['MATCH (a:Apple) RETURN COUNT(a) AS apples','MATCH (a:Apple), (o:Orange) RETURN COUNT(a) AS apples, COUNT(o) AS oranges'];constquery=queries[Math.random()>.5 ? 1 : 0];session.run(query).then((data)=>{console.log(data[0].get('apples'));// will throw if first query is chosenconsole.log(data[0].get('oranges'));});
There should be a way of checking for fields before trying to use them:
session.run(query).then((data)=>{console.log(data[0].get('apples'));// will throw if first query is chosenif(data[0].has('oranges')){console.log(data[0].get('oranges'));}});
The text was updated successfully, but these errors were encountered:
There is no "proper" way to check if a value exists or not in a Record without trying to access and catching for errors.
Take this oversimplified example:
There should be a way of checking for fields before trying to use them:
The text was updated successfully, but these errors were encountered: