I'm trying to do this:
var sortAfter = req.query.sortAfter || '_id';
var ascending = req.query.direction || -1;
var sorted = {sortAfter: ascending};
But a console.log(sorted) output the following object:
{ sortAfter: -1 }
It's like the first variable is not used in the object creation...
Question: How do i get the object to be made of two variables, and not one variable and one fixed string?