So I have a node endpoint that fetches documents from mongodb. I am seperating data[0] and data[1] into variables because I want to do stuff with it and then chain both back into one varaible and send it.
code:
const data = await Data.find();
const data1 = data[0].api.results;
const data2 = data[1].api.results;
// Do stuff
const response = data1 + data2;
res.send(JSON.stringify(response)); // with and without JSON.stringify I still get [object, Object]
Note: both mongodb documents have the exact same structure. Everything works fine if I just send one variable so I think it has to do with JSON.stringify.