How does mongoose query different types of data many times and return to the foreground page?

  node.js, question

For example, if the collection is called post, I want to query the data of type A and flashback the data of that type back to the foreground page, which can be written as follows:

post.find({type: 'A'}).sort({_id: -1}).exec(function(err, docs) {
 if (err) {
 var typeAData = docs;
 Res.render ('index',' title:' home page', typeAData: typeAData});

However, if I want to query the data of type A, type B and type C and return these three types of data to the foreground page, how should I write them?

Because ..res.renderMust write to query data (post.find) callback function, and these three types of data belong to the Parallel relationship, so I can’t query A, then nested query B, then nested query C ..

Then you need to query type a, b and c data and return them to the foreground. How to write it?

The query criteria read as follows:


The result is this:
typeadata = docs.filter(i=>i.type==’A’);
typebdata = docs.filter(i=>i.type==’B’);
typecdata = docs.filter(i=>i.type==’C’);

If only the first five are selected:
typeadata = docs.filter(i=>i.type==’A’).slice(0,5);
typebdata = docs.filter(i=>i.type==’B’).slice(0,5);
typecdata = docs.filter(i=>i.type==’C’).slice(0,5);