Get related objects for every row in query results

Hello, I have a query which finds an Audit, then some related DetailAudit objects (one-to-many) and this related model has a “relation” column standards (many-to-many).

The DetailAudit objects are passed to a view and in that view I have to get the standards related objects but I don’t know how.

How can I extract the “standards” relation column in my pug view?

This is the function that gets these objects:

function show(id, handler) {
  var query = new Parse.Query(Audit);
  query.include("auditTest");
  query.include("standar");
  query.include("category");
  query.include("type");
  query.include("auditLeader");
  query.include("auditTest");
  query.include("conclusiones");
  query
    .get(id)
    .then(function (audit) {
      var query = new Parse.Query(DetailAudit);
      query.equalTo("audit", audit);
      query.include("audit");
      query.include("auditor");
      query.include("standar");
      query.include("standards");
      query.include("area");
      query.include("process");
      query.limit(1000);
      query.find({
        success: function (details) {
          audit.details = details;
          handler({
            status: 200,
            msn: "Detalles listadas exitosamente",
            audit: audit,
          });
        },
        error: function (error) {
          //handle error
        },
      });
    })
    .catch(function (error) {
      // catch error
    });
}

Thanks in advance.

It should be something like obj.relation('relationName').query.find()

You can see more details here: JavaScript Developers Guide | Parse

Sidenote, the JS API for include accepts an array as well, so rather than include('a').include('b').include('c'), you can just do include(['a', 'b', 'c']).