Is that what gateway.toTuple(doc) is doing just below that?