Convert aggregation results to JSON

How can I convert my aggregation results to JSON format inside a Stitch function?

I want to do this to post them via http.

I found the answer, I’ll include here for reference. Need to include this at the end of the aggregation pipeline:

      .toArray()
      .then(docs => console.log("all documents", JSON.stringify(docs)));