Under what scenarios does Dgraph return an array in place of a string?

It doesn’t look like this is always happening (based on the demo script anyway).

Ok, I can work with this, or anything where it’s always one or the other.

I’m using 116 to assign the value of the bar3 query to the bar uid predicate, replacing the previous bar2 uid that was set there in line 84.

I’m not sure what you mean about line 125. I’m looking up every Foo to print its results (although there’s only one). The foo variable is out of scope at that point as the request that defined it was run on line 123.

I don’t know, running the script multiple times gives different output for the bar_name predicate. Do you see a problem in the loop?