Server Code - How to combine results of two Queries into one result/object

In my server code, I want to combine the results of two queries into one result.

This is my code below:



var dbId1 = "XXXXXXXXXX";
var collection1 = "CollectionName1";

var dbId2 = "XXXXXXXXXX";
var collection2 = "CollectionName2";

var params1 = {};
var params2 = {};

//First query return these three columns from Collection1
params1.proj = {'name:1,'address':1,'email':1};

//Second query return these three columns from Collection2
params2.proj = {'name:1,'address':1,'email':1};

// ???? How do I combine the results of both queries into one result???
var result1 = Collection.query(dbId1, CollectionName1, params1);
var result2 = Collection.query(dbId2, CollectionName2, params2);
var result = result1 + result2; // <--- This does not work.

Apperyio.response.success(result, "application/json");


Thanks in advance.
1 person has
this question
+1
Reply