Find nodes without a type

I ran some queries that created nodes without a type (by accident). I can find them because I happen to know what predicates I included with the node, but I’m concerned I may have made this mistake elsewhere, or may in the future. What is the best way to find typeless nodes?

The only option I have come up with so far is to query the schema (schema {}) and then run a query for each predicate with a filter. Is this a good method or is there a better option?

const schema = await txn.queryWithVars('schema {}');

const predicates = schema.getJson().schema.map(s => s.predicate);

const query = `query {
${predicates.map(p => `${p}(func: has(${p})) @filter(not has(dgraph.type)) { uid }`).join('\n')}
}`;

const typeless = await txn.queryWithVars(query);
const json = typeless.getJson();

Object.keys(json).
	filter(p => json[p].length > 0).
	forEach(p => console.log(`${p}: ${json[p].map(n => n.uid)}`));

You can do something like

upsert {
  query {
    v as var(func: has(predicate)) @filter(not has(dgraph.type))
  }

  mutation {
    set {
      uid(v) <dgraph.type> "MyType" .
  }
}

Yeah, once I figure out the type of node they should be I’ll run that mutation. Should work fine.